|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#3
|
|||
|
|||
|
Re: autonomous code variable?
Quote:
Here is some of our code. (Warning: I am not one of the programmers.) We have multi-bank code. See Innovation FIRST site for an explanation and example. We have our autonomous code in bank 2. Below is how we jump to bank 1 where our driver controlled code is, when autonomous is over. '---------- Aliases for the Pbasic Mode Byte (PB_mode) ------------------------------- '---------------------------------------------------------------------------------------------- ' Bit 7 of the PB_mode byte (aliased as comp_mode below) indicates the status ' of the Competition Control, either Enabled or Disabled. This indicates the ' starting and stopping of rounds at the competitions. ' Comp_mode is indicated by a solid "Disabled" LED on the Operator Interface. ' Comp_mode = 1 for Enabled, 0 for Disabled. ' ' Bit 6 of the PB_mode byte (aliased as auton_mode below) indicates the status ' of the Autonomous Mode, either Autonomous or Normal. This indicates when ' the robot must run on its own programming. When in Autonomous Mode, all ' OI analog inputs are set to 127 and all OI switch inputs are set to 0 (zero). ' Auton_mode is indicated by a blinking "Disabled" LED on the Operator Interface. ' Auton_mode = 1 for Autonomous, 0 for Normal. ' ' Autonomous Mode can be turned ON by setting the RC to Team 0 (zero). ' ' Bit 5 of the PB_mode byte (aliased as user_display_mode below) indicates when ' the user selects the "User Mode" on the OI. PB_mode.bit5 is set to 1 in "User Mode". ' When the user selects channel, team number, or voltage, PB_mode.bit5 is set to 0 ' When in "User Mode", the eight Robot Feedback LED are turned OFF. ' Note: "User Mode" is identified by the letter u in the left digit (for 4 digit OI's) ' Note: "User Mode" is identified by decimal places on the right two digits (for 3 digit OI's) comp_mode VAR PB_mode.bit7 auton_mode VAR PB_mode.bit6 user_display_mode VAR PB_mode.bit5 'After our autonomous routine, we wait for autonomous to end. WaitQuitAutonomous: do Gosub SerialInput ' Quit autonomous mode when it's time Gosub TestQuitAutonomous Gosub SerialOutput loop TestQuitAutonomous: ' (Test if its time to run the main loop (competition code) if auton_mode = 0 then Run 1 ' (If autonomous is turned off, we jump to bank 1 and run the driver controlled program) if AutonomousSwitch = 0 then Run 1 ' (We have a switch on our robot which allows us to turn off autonomous mode) ' Keep going in autonomous mode Return Hope that helps. Last edited by DougHogg : 28-03-2003 at 00:17. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 26 variable limit | Gusman1188 | Programming | 9 | 12-02-2003 22:38 |
| Coupling the Chiaphua & a variable Drill output | Jeff Sharpe | Motors | 9 | 13-01-2003 20:21 |
| Variable Amperage in DC Circuit. How? | Jordan A. | Electrical | 4 | 01-11-2002 20:26 |
| Dashboard programs and the char variable | Ian W. | Programming | 13 | 26-06-2002 02:07 |
| what teams have a variable transmissions? | Greg Perkins | Technical Discussion | 4 | 06-03-2002 06:10 |