Chapter 12. Decisions, Decisions

This chapter covers the final block in the Common Palette. When you are finished with this chapter, you will have the ability to create some great programs for your robots and give them the ability to move, talk, listen, bump, stop, wait, and a lot more. (But there are plenty more NXT-G blocks to learn about, so don't stop reading yet!)

Let's give your robots one more talent—the ability to make choices and select from multiple possible actions. Choices are very important to your robot; with the ability to decide between two or more options, your robot can perform much more complicated actions.

Left or Right? Door One or Door Two?

Let me give SPOT some pseudo-code for his next task:

  • Me: SPOT, I want you to move forward ...

Get Lego Mindstorms NXT-G Programming Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.