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

conclusion

This chapter has covered using numbers and logic in your programs. The Math block is used for operating on numbers, and in most cases will behave exactly as you’d expect. Knowing how integer or floating-point math works (depending on which version of NXT-G you’re using) will help you avoid the most common problems encountered with computer math.

The Logic block lets you write programs that make complex decisions, such as combining the input from multiple sensors. The Range block gives you a convenient way to perform the common operation of testing a value to see whether it’s in a certain range. The other block introduced in this chapter was the Random block, which you can use to add a little unpredictability to your programs and personality ...

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