Quote:
Originally posted by f22flyboy
startShift:
leftDrive=127
rightDrive=127
gear_shifting=1
gear_count=0
also what is this here for?
p1_sw_top_prev=p1_sw_top
I see that it sets p1_sw_top_prev=0 but why not just say that?
|
As for time, it will depend on the program length and the number of processor 'slots' you are using. The longer the program scan, the slower the delay will be.
Gear Count =0 will set up a fresh delay since it increments to 40 and stops incrementing until the next time a gear shift is requested. Gear Count would be at 40 coming into that statement
p1_sw_top_prev=p1_sw_top
this type of statement is useful for storing the value of the switch on the previous scan and checking the current state against what you had before to see if a change has taken place, kind of a 1-shot since after the current scan they will both agree again