there and back
The ThereAndBack program will make the TriBot move forward 3 feet, turn around, and then return to where it started. Some measuring is required to solve this problem, so if your rulers are metric, feel free to change the problem to use 1 meter instead of 3 feet.
This program uses three Move blocks: one to move forward, one to spin the robot around, and one to move the robot back to where it started.
moving forward
The first block needs to move the robot forward 3 feet. “Feet” is not one of the duration options, so you need to figure out how far 3 feet is in either degrees or rotations—it doesn’t matter which you choose. I’ll use rotations for this example.
How do you figure out how many rotations you need to turn the motor to travel ...
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.