|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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
|
||||||
|
||||||
|
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! |
|
#3
|
|||
|
|||
|
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)) |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |