Skip to Main Content
The Art of LEGO MINDSTORMS NXT-G Programming
book

The Art of LEGO MINDSTORMS NXT-G Programming

by Terry Griffin
August 2010
Intermediate to advanced content levelIntermediate to advanced
288 pages
13h 21m
English
No Starch Press
Content preview from The Art of LEGO MINDSTORMS NXT-G Programming

a programmable timer, version 1

Many of the programs presented so far have used the Wait Time block to add pauses. Although you can set the length of a pause using the Wait Time block’s Configuration Panel, you can’t set it using a data wire, which means that you can’t change the length of time the block waits while a program is running. The next program shows how to get around this limitation by combining a Loop block with a data wire to control when the loop exits, thereby allowing you to adjust the delay programmatically.

The Timer1 program (shown in Figure 10-14) uses the Timer block and a Loop block to create a programmable timer. A Math block is used to put the length of the delay on a data wire, although in your own programs you would usually ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The Art of LEGO MINDSTORMS EV3 Programming (Full Color)

The Art of LEGO MINDSTORMS EV3 Programming (Full Color)

Terry Griffin

Publisher Resources

ISBN: 9781593272180Errata