View Single Post
  #21   Spotlight this post!  
Unread 25-10-2003, 13:55
Sachiel7's Avatar
Sachiel7 Sachiel7 is offline
<Yes I managed to flip it
AKA: Shayne Helms
FRC #1132 (RAPTAR Robotics)
 
Join Date: Sep 2002
Rookie Year: 2002
Location: Richmond, VA
Posts: 541
Sachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really nice
Send a message via AIM to Sachiel7
I use this method:

F_Count > Function Counter. This counter is set at the beginning, and performs a task based on it's number.

T_Count > The number in seconds for each task (F_Count) to be performed. This could be turned into an array for separate times per function.

counter > A temporary Cycle counter. The Main User Routines (17ms) loops about 58 times/sec. So, the main loop thus contains:

counter ++;

if (counter > (T_Count * 58))
{
F_Count ++;
counter=0;
}

Then, we simply check the value of F_count to define the robot's Current Functions:

if (F_Count == 2)
{
pwm01 = pwm02 = 254;
pwm03 = 0;
pwm04 = 254;
}

Now, I could use a switch instead of a bunch of 'if's, but the last time I tried the compiler didn't like it...
So, F_Count 1-10 could be one function, 12-16 another, etc. You need to alot one extra value check for each main function to reset it, if you want it to loop:

if (F_Count == 11)
{
F_Count = 1;
}

etc.

The way I'm currently switching between them is in the programming. I just change the F_Count's Initial Value, and T_Count's value accordingly.
You could easily set up your digital i/o pins so that you can install a jumper on a set of pins and it will trigger a certain auto mode. I'm working on something like that now...
__________________
-=Sachiel7=-

There's no such thing as being too simple!
Look for Team #1132, RAPTAR Robotics at the VCU Regional this year!