View Single Post
  #2   Spotlight this post!  
Unread 13-02-2003, 23:34
Happy Birthday! ejthe4th ejthe4th is offline
Active User
AKA: EJ Meyer
#0240 (Mach Vee)
Team Role: Engineer
 
Join Date: Jan 2003
Location: Monroe, MI
Posts: 20
ejthe4th is on a distinguished road
one way you could accomplish timing is using the basic controller's constant speed, the controller runs at about 38 Hz (38 times a second). if you wanted to count time you could have something like Time = Time + 1 + delta_t. Time would be the times the program has looped through, you add one to make it one more time and add delta_t in case the program "reset" because it took too long to respond (delta_t is the amount of packets missed) some syntax for the control could be

Time = Time + 1 + delta_t

if Time < 19 then 'counts to about 1/2 second
p1_y = 254
p3_y = 254
endif

if Time > 19 then 'after 1/2 second robot stops
p1_y = 127
p3_y = 127
endif

if you want 1 second you could replace 19 with 38, because 38 cycles is approx. 1 second, use greater than and less than symbols because it'll do that action during that time period and also in case the program happens to miss that exact cycle it won't skip that phase of your code

you would also have to define your variables, you don't have to use time, that's just something that i picked, you may also have to "define" (take out the comment in front of delta_t) and also set change c_delta_t CON 0 to c_delta_t CON 1 and include it in the serin line (look at the example above it for the correct placement in the line)
__________________
Mach Vee Team 240
2004 GLR Semi-Finalist
Captian
Programmer
Electrician
Fabricator
Designer