the rotation sensor

Each NXT motor has a Rotation Sensor built into it that measures how far the motor has turned. You can use this sensor to control how far the robot moves as an alternative to the Move block’s Duration setting. This gives you an easy way to make the program perform certain actions while the robot is moving. For example, you’ll change the BumperBot program to make the TriBot beep while backing up.

While your program is running, the Rotation Sensor tracks how far the motor has moved. You can read this value at any time, the same way you read values from the other sensors. You can also reset the Rotation Sensor value to 0, allowing you to measure how far the motor has moved between any two points in the program. (In most cases, ...

Get The Art of LEGO MINDSTORMS NXT-G Programming 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.