View Single Post
  #2   Spotlight this post!  
Unread 02-11-2011, 16:53
Kovs's Avatar
Kovs Kovs is offline
Registered User
FRC #1259 (Paradigm Shift)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Pewaukee, Wisconsin
Posts: 19
Kovs will become famous soon enough
Re: Should this code work as intended?

(As a warning, I use the IterativeRobot to code instead of the SimpleRobot, so there might be some error in my post)
The autonomous and operator control methods only run once when the robot is enabled, so when you start autonomous mode, it does do "test.set(0.75);" but right after that autonomous ends, putting it in disabled mode, which sets the motors to 0 . To fix this, you have to have a loop to repeat in the code, such as:
Code:
while( isAutonomous() && isEnabled() ) {
         test.set(0.75);
}
or, since you don't have to keep setting the speed controller value, you can do:

Code:
test.set(0.75);
while( isAutonomous() && isEnabled() ) {
}
which should set the motor to 75% when autonomous is enabled and will run til autonomous is disabled (or when the robot breaks).

Also, you should read this, it'll help: http://first.wpi.edu/Images/CMS/Firs...va_for_FRC.pdf
Reply With Quote