Programming Question from our Forum
The following question was posted to our forums by Itry:
"Hi. I'm new to NXT, and trying to figure out the basics of programming. I need a light sensor to detect change in ambient light levels, and if above a certain range to activate rotation of a motor in the forward direction 4 turns & stop, and if below a certain range to activate rotation of the same motor in the reverse direction 4 turns and stop. The motor needs to complete its assigned 4 rotations before being allowed to reverse. The program needs to run continuously, forever, so that once the light level changes beyond the threshold in either direction, the motor will react. HELP?"
Well, here's a screen capture of my solution. My comments in the image should be sufficient to comprehend the program. Maybe other readers can offer up their own ideas.