conclusion

Writing a line-following program is a classic NXT exercise that can challenge you to use all your NXT-G skills. The LineFollowerConfig program and the accompanying changes to the LineFollower program from Chapter 6 demonstrate how to use a file to store a setting for a program. This lets you avoid hard-coding values, making the program more flexible. You can use this technique for any program where the sensor target values or other settings may need to be changed.

The LineFollower2 program uses a proportional control algorithm to improve the TriBot’s responsiveness to changes in the direction of the line. Using the Light Senor reading and a little math to determine how much the robot should turn allows the robot to both move quicker ...

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.