Move Until Dark

What is the behavior?

The robot will move, until it sees dark. It accomplishes this through a light sensor, sensing if the light on the ground is higher or lower than the set average. If the light value is lower then the average, then the robot will stop or move on to whatever the next assignment is.

How do you program complete the behavior?

First Place a Move Block into your program and set the desired direction. Set the distance for unlimited. Then take a Wait Until Block and set it to Light Sensor. Take a light reading of both the track and where you want the robot to stop at. Find the average of both and set that number as your threshold. If you want to stop at dark set the Greater than or Less than option to Less than. If you want to stop at light, set it to Greater than.

What is a real-world application for the behavior?

Cars today use light sensors to tell when they should turn on their headlights.
We could create solar panels that could follow the sun.
There are light sensors on ipods and iphones to tell the screen to get brighter when there is less light out.
Industrial robots sense the ends of the fabric roll.

(Try to think of some other applications of this behavior--either real or potential future applications)

Video demonstration of the behavior.