View Single Post
  #8   Spotlight this post!  
Unread 22-01-2003, 20:01
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,573
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
First of all, don't use the pause command. This will cause the robot controller to stop executing all code, and miss packets from the OI. If it misses 5 packets in a row, the robot controller resets, which is a bad thing.

Radio data is sent approximately every 26ms. You can use this exactly as a timer if your loop speed is guaranteed to be less then 26ms. Otherwise, you can use the delta_t variable, which tells how many packets that you missed.

The code in the first post is on the right track, but has some logic errors, here is how I would write it.

if a_count < 115 then firstthreesec
if a_count >= 115 & a_count < 154 then fourthsecond
'do whatever you want after fourth second here
goto done
firstthreesec:
drive_R = 127 'neutral
goto done
fourthsecond:
drive_R = 224
done:
a_count = a_count + 1 + delta_t




PS: this thread is close to violating the part of the user agreement that says
Quote:
You also agree not to post the same message in multiple forums, or use the forums as a real-time chat, continuing a 2-3 person conversation on for numerious posts in a short period of time.

Last edited by Joe Ross : 22-01-2003 at 20:03.