Quote:
|
Originally Posted by Code\\monkey
can you use the switches for other stuff? like if you want to change from IR autono to dead reck autono?, or if you have two dead reckonin codes, be able to switch it before the game?
If you can, can you tell me the variable asigned to the pins?
Thanks.
|
Yes, that's one of the main uses of switches.
We have:
- Left/Right switch
- Red/Blue alliance (the combinaton of these two specify the beacon type and which side of the robot the 10 pt ball will be on.)
- a 16-position BCD switch for selecting autonomous modes. It also doubles as a diagnostics switch when in user mode, e.g., center servos.
You can use a multi-position rotary switch from your local Radio Shack by wiring each position to a different available digital input.
Then test it in your code like so:
Code:
if (!rc_dig_in01)
{
IR_Tracking();
}
else if (!rc_dig_in02)
{
Dead_Reckon();
}
else
Dead_Reckon(); // Always finish with a default setting