View Single Post
  #2   Spotlight this post!  
Unread 21-02-2014, 10:17
Sparkyshires Sparkyshires is offline
Registered User
AKA: Michael Shires
FRC #0384 (Sparky)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2006
Location: Virginia
Posts: 226
Sparkyshires is an unknown quantity at this point
Re: BCD switch programming

Have you looked at the digital inputs on the driver station? Our team uses those exclusively for deciding which autonomous we're going to use. Last year we had 7 different autonomi xD And we use a big 'if' statement, with the arguments looking something like this:
Code:
if(ds->GetDigitalIn(1))
{
	//Autonomous1
}
else if(ds->GetDigitalIn(1))
{
	//Autonomous2
}
etc.. This is a simple way to do it. You could also use a switch-case statement, would definitely be one of the few uses in robot programming to use it. The only reason we don't is just that switch-case statements are so rarely useful in FRC programming that we normally forget about them you would have to pass your switch case variable as an argument in the GetDigitalIn function.
__________________
"Measure with a micrometer, mark with chalk, cut with an axe."