View Single Post
  #5   Spotlight this post!  
Unread 30-04-2010, 12:55
efoote868 efoote868 is offline
foote stepped in
AKA: E. Foote
FRC #0868
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2005
Location: Noblesville, IN
Posts: 1,420
efoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond reputeefoote868 has a reputation beyond repute
Re: Older FRC autonomous code

Did that compile OK?
When you loaded it and ran autonomous, I (hope) the robot just stayed still. Luckily your last state was no movement, because without break statements, it'll run through all the states.

Should be:

switch(variable)
{
case 0:
//do stuff
break;

case 1:
//do other stuff
break;

case 2:
//do some stuff, and case 3's stuff

case 3:
//do something else
break;

default:
//do nothing
break;
}

If you take the default case out in your current setup, you should drive forward forever (which is dangerous, so I suggest you don't).
I also suggest that you disconnect the motors and just watch lights to see if its doing what you want.
__________________
Be Healthy. Never Stop Learning. Say It Like It Is. Own It.

Like our values? Flexware Innovation is looking for Automation Engineers. Check us out!

Last edited by efoote868 : 30-04-2010 at 12:57. Reason: a little clarification