|
Ok, I'm back (sort of). Actually, I'm sitting in my CSci class right now, but I don't really feel like listening, so I'm responding here.
The p1_sw_top_prev=p1_sw_top does exactly what Matt said, it stores the state for the next loop. Since almost no one can press and release a button within 1/40th of a second, we need to make sure that it is actually a "new" button press and not just someones finger left on the switch from earlier. This lets us use the top switch as a toggle. I.e. each time you press it, the gear we are in changes.
As for the timing, it ends up being about 1.5-2 seconds from the time you press the button to the time you can drive again. That is for the full 40 loops. The 10 loop part takes approx. 1/4 as long.
If you can understand this type of time-delay, you have a very good grasp on PBASIC as this type of looping isn't overly intuitive.
Anyway, let me know if there are any other sections that are unclear or don't make sense.
--Rob
|