Main Article Content
Traffic lights are signaling devices positioned at road intersections, pedestrian crossings, and other locations to control flows of traffic. An actual traffic light alternates the right way of road users by displaying lights of a standard color (red, yellow/amber, and green), using a universal color code (and a precise sequence to enable comprehension by those who are color blind). In the typical sequence of colored light, (1) illumination of the green light allows traffic to proceed in the direction denoted; (2) illumination of the yellow/amber light denoting ready to proceed in the direction denoted; and (3) illumination of the red signal prohibits any traffic from proceeding. Usually, the red light contains some orange in its hue, and the green light contains some blue, for the benefit of people with red-green color blindness, and green lights in many areas are in fact blue lenses on a yellow light (which together appear green). Program was written for the MDE trainer kit to control the outputs of the microcontroller in a given sequence. Green and red light-emitting diodes (LEDs) are connected to the microcontroller outputs. First, the assembly language programs were written to turn on only one LED and then turn off the same LED. Next, the program is improved by making the LED blink, and then, the input switches are read. The walk push button and the other indicating a car at the crossing light are turned on. As switches are mechanical objects, some debounce time (timer programmed dead time of 50 ms) is also placed in the program. The light is controlled as long as each LED with one switch is pressed, and the LED is ON and when the switch is not depressed, the LED is OFF. Then, the LED will be made to blink once per second as long as the associated switch is ON. Finally, the program is improved when a subroutine is added where the traffic light controller is on green or red stays ON while the corresponding switch is ON. If more than one switch is activated, then the ON is for the red light. The LEDs simulate the traffic lights and switches simulate the walk push button and the car presence sensor at a crossroad.