View Single Post
  #5   Spotlight this post!  
Unread 26-02-2006, 16:51
intelitek_Chris intelitek_Chris is offline
Registered User
no team
 
Join Date: Dec 2005
Location: Manchester
Posts: 19
intelitek_Chris will become famous soon enoughintelitek_Chris will become famous soon enough
Re: EasyC autonomous modes

Good Question!

There are probably many ways to do this (select between multiple autonomous programs). Here is one of many possible suggestions.

Have a series of switches that form a binary number (like the channel selection on your OI). If you had 3 switches, all off, for example, you would have program 1 selected. If the switches were all on, program 8 would be selected.

In your easyC code, have Initialize stuck in a loop, waiting for somekind of input from the controls (say Button BB). When you have all your switches set correctly (this can be after the robot has been placed on the field), press button BB. This will set a variable, say 'AutProg' to a number, as designated by your switches, and exit the loop in Initialize. Now, when the match starts, your autonomous function will immediately begin running the program that corresponds to the variable 'AutProg', and begin running the program.

If you ever have to reset the robot for any reason (from the OI), you can jump out of initialize by pressing the button BB. You won't run any autonomous code, because the field control will be in Operator Control (and the autonomous flag will be off), but this way you will have direct control over how long the initialize function stays looping (it will loop until you hit button BB).

You could do all of this with a single button, if write enough code, and don't have multiple switches. Just set some timers up to record times between button presses, and create a code for entering in which autonomous program to use. Hope this helps!