LEGO Engineering

| | | | | | | |
In NXT-G, how can I write a program to command a 2-motor car to drive straight until it reaches a black line?


19th of April, 2010

(5 )
100% thumbs up 0% thumbs down

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.
   :
   :
* :
* :
 


Home | About Us | Contact Us

© 2013 Center for Engineering Educational Outreach, Tufts University
© 2013 The LEGO Group. All rights reserved.