|
Re: [OCCRA]: Template
This template and pushbutton work on my VEX robot at home. Please try it on yours. You will need to wire the Start Button to digital input 5 in order to make the program work.
Here were the issues I found with your program
1) Your configuration template still had input one configured as analog and not digital. The default configuration uses input 5 as a digital input. Whatever you are doing will be fixed by wiring a Start push button switch to input position 5.
2) You did not latch or save the value of the switch. The program runs very fast. Your original program would have run for two seconds after you pressed start switch (only because of your 2000 msec wait loop). On the next loop, once you let off the switch, the program would now read a one (not pressed) and stop the motors. The solution is shown and once the switch reads a zero (0 = pressed), you need to latch or save the value in a variable that is different than just reading the value (which happens in only one place and is very fast). The variable should be initialized as the not pressed state in order to not have the software think that at start up initialization that it has already been pressed.
3) I added a remote control tank function block in both autonomous and operator control. The tank works only in operator control as expected.
4) After you program the robot, you always need to cycle the power (turn it off then on). Using the terminal window for debugging, I turned on the robot and quickly pressed the Start Button. Watch the print statements that I have added to help debug the program. The autonomous program starts[Print] , the Start Switch is pressed [Print] and the robot moves forward [Print] (with 800 msec wait loop for print statement) . If you don't press the Start Switch, you receive another print message in the terminal window (Motor Stop) [Print].
5) The terminal window will also show when the Autonomous mode is operational (15 seconds), and show when Operator Control Mode becomes active (120 seconds). I watched the terminal window while cycling the power on, and quickly pressing the start switch. I ended up counting 15 print statement messages indicating that the motor was moving forward for the 15 seconds of the autonomous period.
__________________
Marc Center 
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377
Last edited by marccenter : 19-11-2012 at 17:13.
|