Traffic Intersection
traffic intersection
By: Marc Newman-Simoneau
what I coded was a traffic intersection using 12 LEDS, many jumper wires and resistors.
Supplies
Arduino Uno
jumper wires
12 or more led's
220 ohm resistors
breadboard
Wiring
in this step I will share my code and wiring diagrams
code for reference
void setup()
{
pinMode(13, OUTPUT); // corrects the brightness of the leds so you cam actually see them
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);// corrects the brightness of the leds so you cam actually see them
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);// corrects the brightness of the leds so you cam actually see them
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
pinMode(4, OUTPUT);
pinMode(3, OUTPUT);// corrects the brightness of the leds so you cam actually see them
pinMode(2, OUTPUT);
pinMode(1, OUTPUT);
}
void loop() {
digitalWrite(10, HIGH);// makes the lights turn on
digitalWrite(4, HIGH);
digitalWrite(11, HIGH);// makes the lights turn on
digitalWrite(5, HIGH);
delay(4000); // delays the next code by 6 seconds
digitalWrite(10, LOW);
digitalWrite(4, LOW);// makes the lights turn off
digitalWrite(11, LOW);
digitalWrite(5, LOW);
delay(1500);// delays the next code by 1.5 seconds digitalWrite(6, HIGH);
digitalWrite(12, HIGH);// makes the lights turn on
digitalWrite(2, HIGH);
digitalWrite(8, HIGH);
delay(3000); // delays the next code by 6 seconds
digitalWrite(6, LOW);
digitalWrite(12,LOW);// makes the lights turn off
digitalWrite(2, LOW);
digitalWrite(8, LOW);
delay(2000);
digitalWrite(7, HIGH);
digitalWrite(3, HIGH);// makes the lights turn on
digitalWrite(9, HIGH);
digitalWrite(13, HIGH);
delay(4000); // delays the next code by 6 seconds
digitalWrite(7, LOW);
digitalWrite(3, LOW);// makes the lights turn off
digitalWrite(9, LOW);
digitalWrite(13, LOW);
delay(3000); // delays the next code by 6 seconds
digitalWrite(6, HIGH);
digitalWrite(12, HIGH);
digitalWrite(2, HIGH);// makes the lights turn on
digitalWrite(8, HIGH);
delay(2000); // delays the next code by 6 seconds
digitalWrite(6, LOW);
digitalWrite(12,LOW);
digitalWrite(2, LOW);// makes the lights turn off
digitalWrite(8, LOW);
}
Diagrams
this is my wire diagram labeled as best i could because i could not write well with the editor and 3d paint
Main Problems
my main problems were that the buttons wouldn't work for me, one of the days the port wouldn't read and the rest were mainly wiring problems on my part like putting them in the wrong pins. those were the technical problems .
the other difficulties were just on my part
Items and Costs
https://www.amazon.com/eBoot-Pieces-Emitting-Diode...
leds 5.99 for 100
https://www.amazon.ca/Quimat-Multicoloured-Solderl...
jumper wires 9.99 for 65
https://www.amazon.ca/Arduino-Development-Microcon...
arduino uno 3 for 13.29
https://www.amazon.ca/Breadboard-Solderless-Protot...
bread board 3 for 10.99
https://www.sparkfun.com/products/10969
resistors 500 for 7.95
total price : 54.37
tax included