Quote:
|
Originally Posted by Xufer
...how would i do it if i was to have like 4 auton modes...
|
You have a couple of options. Simplest in your case would probably be to do something like this:
Code:
// somehow get a number in the "auto" variable
auto = (rc_dig_in18<<2) | (rc_dig_in17<<1) | (rc_dig_in16);
// or whatever it takes to turn your switches into a value
if (auto==1)
{
// code for mode 1
}
if (auto==2)
{
// code for mode 2
}
// etc.
It might theoretically be more efficient to use a
switch/case statement instead of a string of
ifs, but you probably have enough to focus on right now without worrying about learning another control structure.