|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#12
|
|||
|
|||
|
Re: Older FRC autonomous code
mark i tried the following code from one of my students and it does not seem to work, i will try your code above.
any help is greatly appreciated. by the way i am opening up the user-routine_fast.c to modify the autonomous code is that correct? thanks // Drive forward, turn, return, and stop void Autonomous() { static int counter=0; //keep track of loops to use as a crude timer - static keeps it around from call to call static int autostate=1; //keep track of what step we're supposed to be doing switch (autostate) { case 1: // Drive forward pwm01 = pwm02 = 200; pwm03 = pwm04 = 54; //motor is reversed if (counter>38) //1 second { autostate = 2; // move on to the next step counter = 0; // reset our timer for the next step } case 2: // Turnaround pwm01 = pwm02 = 200; pwm03 = pwm04 = 200; //motor is reversed if (counter>76) //2 seconds { autostate = 3; counter = 0; } case 3: // Drive forward (returning now) pwm01 = pwm02 = 200; pwm03 = pwm04 = 54; //motor is reversed if (counter>38) //1 second { autostate = 4; counter = 0; } case 4: // Stop - What to do when everything else is done default: // also what to do if an invalid autostate occurs pwm01 = pwm02 = pwm03 = pwm04 = 127; // Make sure the last thing you do is always stop } counter++; } |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Autonomous 2010 FRC | Drucifur | Java | 10 | 14-02-2010 08:06 |
| FRC...autonomous or driver-controlled competition? | tribotec_ca88 | General Forum | 28 | 10-03-2005 14:47 |
| Autonomous code | PBoss | Programming | 7 | 14-01-2003 15:29 |
| Autonomous Code | Adrian Wong | Robotics Education and Curriculum | 1 | 18-11-2002 22:34 |