View Single Post
  #7   Spotlight this post!  
Unread 07-01-2007, 21:15
DanDon's Avatar
DanDon DanDon is offline
ohhh MY god
AKA: Dan Hoizner
FRC #0375 (The Robotic Plague)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Staten Island, NY
Posts: 1,432
DanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond repute
Send a message via ICQ to DanDon Send a message via AIM to DanDon Send a message via MSN to DanDon
Re: EasyC: Execute code before autonomous

Quote:
Originally Posted by Kingofl337 View Post
You only need to call isEnabled to make sure the while loop ends and you don't get stuck in initialize. Initialize is run every time you reset your robot to calibrate any sensors that may need it.

Code:
void Initialize ( void )
{
      while ( IsEnabled() ) // while the robot is not enabled
      {
            if ( GetOIDInput ( 1 , 1 ) ) // If Trigger is Pulled Go Next Auto
            {
                  automode ++ ;
            }
            else if ( GetOIDInput ( 1 , 2 ) ) // If Thumb is pushed go prev automode
            {
                  automode -- ;
            }
            SetUserDisplay ( automode ) ; // send current automode to OI display
      }
}
Shouldn't that be:

Code:
 while ( !IsEnabled() ) // while the robot is not enabled
      {
            if ( GetOIDInput ( 1 , 1 ) ) // If Trigger is Pulled Go Next Auto
            {
                  automode ++ ;
            }
            else if ( GetOIDInput ( 1 , 2 ) ) // If Thumb is pushed go prev automode
            {
                  automode -- ;
            }
            SetUserDisplay ( automode ) ; // send current automode to OI display
      }
?
__________________