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.
|