2010-01-24

arduino: traffic lights



During Arduino workshop I developed a traffic lights set with 3 different modes controlled by an ambient light sensor and a potentiometer:
• day-light mode—green light and red light flashing phases are the same length—active when reading from the light sensor are above a certain threshold;
• night-light mode—green light phase is twice as long as the red light phase—active when reading from the light sensor are lower than the threshold (sensor gets covered with a finger in the video);
• alert-mode—only the yellow light flashes—active when reading from the potentiometer is below an assigned value.

The whole piece is quite simple, but proved quite useful to understand how to actually write code myself. The code can be viewed >>here<<