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

advantages of using a sensor block

You could write the GentleStop program without using the Sensor block by using a Switch block configured to use the Ultrasonic Sensor and making the comparison with the trigger value (in this case 10). However, that approach wouldn’t allow enough flexibility for the next step. Although having the Switch block work directly with a sensor is simple, you gain some advantages from using a Sensor block and passing the result of the comparison to the Switch block using a data wire:

  • You can configure a Sensor block using data wires. For example, you can change the trigger value while the program is running. When using a Switch block, the settings for the sensor can be set using the Configuration Panel only.

  • You may want ...

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