Thanks for the proper vb tags Greg. I went and read up on the vb Code help after you pointed that out.
Doug,
Here's an example of what one of our autonomous program scripts looks like. We don't recode as in my beginners example above, but we change the script instead. It makes it simpler to change the autonomous movements quickly with less risk of introducing coding errors. We have a graphical interface where you drag and click the cursor on an image of the playing field where you want the robot to go and the script gets generated automatically. When each command is executed a subroutine specific to that command does the proper setup and it gets submitted to a master control routine.
The basic command format is: COMMAND, SPEED, DISTANCE
These values are defined constants. Other commands have some variation on the arguments, for instance, some commands have "on/off" arguments and the arm commands are really POT readings.
Code:
'Basic ramp attack
LeftProg Data CmdFrwd, SpdFull, 25 'Pull out
Data CmdRght, SpdFull, 40 'Move in front of ramp
Data CmdOpen, SpdFull, 10 'Open arms
Data CmdArmB, SpdFull, 50 'Drop arm
Data CmdBack, SpdFull, 130 'Up ramp
Data CmdStop, SpdStop, 1 'Come to a stop
LeftMax CON 6 'Auto sequence Maximum entries is 255
RghtProg Data CmdFrwd, SpdFull, 25 'Pull out
Data CmdLeft, SpdFull, 40 'Move in front of ramp
Data CmdOpen, SpdFull, 10 'Open arms
Data CmdArmB, SpdFull, 50 'Drop arm
Data CmdBack, SpdFull, 130 'Up ramp
Data CmdStop, SpdStop, 1 'Come to a stop
RghtMax CON 6 'Auto sequence Maximum entries is 255
The commands are stored in EEPROM by the DATA statement and READ in sequence like a script.