a programmable timer, version 2

There is often more than one way to solve a problem, with each solution having its own advantages and disadvantages. One disadvantage of the Timer1 program is that it uses one of the three timers, so you’ll need to use a different approach if your program uses all three timers for other tasks. The Timer2 program presented in this section demonstrates an alternative way to build a programmable timer.

The Timer2 program

Figure 10-22. The Timer2 program

Using data wires and a Compare block, you can control the number of times a Loop block repeats. By putting a Wait Time block inside a Loop block, you can control the length of time the program ...

Get The Art of LEGO MINDSTORMS NXT-G Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.