Chapter 11. More Mathematics

Introduction

NXT-G provides the basic mathematical operations, but sometimes we need something more. For example, a navigation routine may need a function that NXT-G does not have. For instance, trigonometry functions are important in navigation, such as finding the quickest way from A to B.

This chapter presents some additions to the Mindstorms repertoire.

Floating Point Arithmetic

Most of the calculations in programming the NXT robots can be done with integer arithmetic, that is, using whole numbers. Sometimes we need floating point numbers, which are numbers that have a decimal point and digits after it.

Some of the action blocks are able to accept floating point numbers. For instance, the motor block can ...

Get Programming Lego Mindstorms NXT 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.