O'Reilly logo

Lego Mindstorms NXT-G Programming Guide, Second Edition by James Floyd Kelly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required