|
|
| In NXT-G, how can I write a program to command a 2-motor car to drive straight until it reaches a black line? |
| (5 ) |
100%
0%
|
One way to program an NXT car to stop on a black line is to use the switch block to constantly check the light sensor for darkness.

In this program, a switch block tells the NXT to constantly check the input from the light sensor. As long as it senses light, motors B and C drive the car forward. When the light sensor senses a darker value (presumably from the black line on the floor), motors B and C stop and the NXT plays a sound.
|