Introduction: Traffic Lights
Traffic lights or traffic signals are those devices, met at the road intersections, used in order to control the traffic flow. In this exercise we are going to find out how to program and also configure a such a device.
Step 1: How to Make the HW Setup
1.Connect jumper wire #1 between D13 pinout from Arduino board and positive pin from red LED.
2.Connect jumper wire #2 between D12 pinout from Arduino board and positive pin from yellow LED.
3.Connect jumper wire #3 between D11 pinout from Arduino board and positive pin from green LED.
4.Connect jumper wire #4 between GND pinout from Arduino board and GND pins from all LEDs with the resistor as it is shown in schematic attached at this step.
5.Plug USB cable to your computer USB port.
Step 2: How to Make the SW Setup
1.Install Arduino IDE, from following link: https://www.arduino.cc/en/main/software;
2.Click on Windows installer;
3.Click on JUST DOWNLOAD;
4.After download is complete, click on RUN button;
5.Click on I Agree button (Arduino IDE is a free software);
6.Select all components from the list and click on Next button;
7.Proceed with the installation after selecting the desired location;
8.Install driver “Adafruit Industries LLC Ports”, by clicking on Install button;
9.Install driver Arduino USB Driver” by clicking on Install button;
10.Install driver “Linino Ports (COM&LPT)” by clicking on Install button;
11.Press CLOSE button when installation is complete;
Download application file :traffic_lights.ino.
Step 3: How to Configure Your Application
1.Non-configurable parameters (marked with red):
# define x y --> define a y port number for a x LED, where y it is a number corresponding with digital pin connected with LED positive PIN and x is the constant name (example: Red).
2.Configurable parameters (marked with green):
•No_of_blinks --> number of blinks between 2 colors
•Green/ yellow/ red time --> period of time while the LED stays ON
•count_blinks/count_blink --> are used for specifying number of blinks for green and red LEDs.
3. Compile and upload software to Arduino board by clicking on Upload button.
Step 4: Tasks
1.Modify the period of a blink from 500 milliseconds, which means 0.5 seconds, to 700 milliseconds, upload again and note which are the changes that occurs;
2.Make the yellow LED to stay turned ON for 1.5 seconds;
3.Make the Red LED to stay turned ON for 4 seconds and the number of blinks for the same LED to be equal with 4.