11

using data blocks and using data wires with loops and switches

Now that you know how data wires work, you can do some really interesting things with more of the programming blocks. You can use some of these new blocks to make the NXT combine and process sensor values so that they can be used as input values for other actions. For example, with the tricks learned in this chapter, you’ll be able to program your robot to do something only when two sensors are triggered at the same time or to do things randomly, rather than performing a series of preprogrammed actions.

In this chapter I’ll show you how to do math on the NXT with the Math block so that you’ll be able to have your robots calculate, for example, the distance to travel based on a ...

Get The LEGO MINDSTORMS NXT 2.0 Discovery Book 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.