Go to Post I saw a big opening in the bees section and asked if we could sit for this match and was told we were welcome to sit there. Your team made space for about 15 of my team members that came with me. - Debbie [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-03-2005, 08:25
DemonYawgmoth's Avatar
DemonYawgmoth DemonYawgmoth is offline
Registered User
AKA: Artem Kochnev
FRC #1396 (Pyrobots)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2003
Location: Staten Island, NY
Posts: 28
DemonYawgmoth is an unknown quantity at this point
Send a message via AIM to DemonYawgmoth Send a message via MSN to DemonYawgmoth
Question about switching autonomous modes

One of our mentors bought us these switches for us to switch between autonomous modes, and we think that this is an analog switch, but we're not sure. Now, where would we hook these switches up, then how would we read a value from them in the code, and then, what would we test for, to see which autonomous mode to run. We know that digital switches have either a 0 or a 1, but how would we test for a 10 bit value, which I believe that the analog switches return. Any help is greatly appreciated.
  #2   Spotlight this post!  
Unread 23-03-2005, 08:43
Kims Robot's Avatar Unsung FIRST Hero
Kims Robot Kims Robot is offline
Onto a New Chapter...
AKA: Kim O'Toole Eckhardt
no team
 
Join Date: Aug 2004
Rookie Year: 1996
Location: Framingham, MA
Posts: 1,467
Kims Robot has a reputation beyond reputeKims Robot has a reputation beyond reputeKims Robot has a reputation beyond reputeKims Robot has a reputation beyond reputeKims Robot has a reputation beyond reputeKims Robot has a reputation beyond reputeKims Robot has a reputation beyond reputeKims Robot has a reputation beyond reputeKims Robot has a reputation beyond reputeKims Robot has a reputation beyond reputeKims Robot has a reputation beyond repute
Send a message via AIM to Kims Robot
Re: Question about switching autonomous modes

We would really need to know more about what your switches are. In general, switches can be hooked to either the analog or digital ports, depending on what you are trying to get out of them.

If you just want an on/off signal (in terms of is each automode on or off), you can hook it to either. Then what you get into the controller (and read in in the code) for the digital ones are 0 or 1 as you mention, and for analog switches you will read in 0 or 255. If you hook the analog switch to the analog port, you will read in a range 0 to 255.

Make sure your code reads in for those switches, and then you can use the input from those switches to control your automode in the section defined in the code for automode (FIRST commented it as such, I dont have the code in front of me, so I dont remember which one it is).

Hope that helps!
__________________
~kim~
Kimberly O'Toole Eckhardt <3
Principal Systems Engineer & Program Manager
History - Team 176, Team 229, Team 1511, FIRST Volunteer!!
My new FIRST Photography Hobby & Angry Eric's Fan Page
Excellence - is the result of caring more than others think is wise, risking more than others think is safe, dreaming more than others think is practical, and expecting more than others think is possible.
  #3   Spotlight this post!  
Unread 23-03-2005, 17:02
jdong jdong is offline
Linux Nerd
AKA: John D
#0245 (Adam-Bots)
Team Role: Programmer
 
Join Date: Apr 2004
Location: Rochester, MI
Posts: 98
jdong will become famous soon enoughjdong will become famous soon enough
Re: Question about switching autonomous modes

At Team 245, we have a rotary, 10-number (4-bit) switch that connects via Digital IO's.

To read in the value, define a macro AUTON_ROUTINE:

Code:
#define AUTON_ROUTINE (rc_dig_in10 | (rc_dig_in11 << 1) | (rc_dig_in12 << 2) | (rc_dig_in13 << 3))
In our case, we have our switch connected to Digital IO's 10, 11, 12, and 13. Adjust accordingly.
__________________
John Dong
Co-Captain, Webmaster / Programmer
Team 245 -- Rochester Adams Robotics
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
a simple autonomous mode question chippermonky Programming 3 18-02-2005 01:54
A little question about the autonomous mode Anton Programming 4 18-01-2005 14:08
switching modes Allison Programming 8 06-04-2004 13:37
Alternative autonomous modes Jon Reese Programming 1 14-01-2004 13:17


All times are GMT -5. The time now is 16:12.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi