Devices & Components
Arduino Uno Rev3
ELEGOO 130pcs Solderless Flexible Breadboard Jumper Wires 4 Different Lengths Male To Male
5 mm LED: Yellow
Active Buzzer
LED, Blue
Breadboard (generic)
5 mm LED: Red
5 mm LED: Green
Software & Tools
Arduino Web Editor
Arduino IDE
Project description
Code
MulticoloredLEDStreamWithBuzzer.ino
c_cpp
Copy and paste this into the IDE
1//Digital Pins/Variables 2int blueLED1 = 2; //Blue LED to Pin 2 3int yellowLED2 = 3; //Yellow LED to Pin 3 4int greenLED3 = 4; //Green LED to Pin 4 5int redLED4 = 5; //Red LED to pin 5 6int buzzer = 6; //Buzzer to pin 6 7 8void setup() { //Setup Code 9 10 pinMode(blueLED1, OUTPUT); //Blue LED as output 11 pinMode(yellowLED2, OUTPUT); //Yellow LED as output 12 pinMode(greenLED3, OUTPUT); //Green LED as output 13 pinMode(redLED4, OUTPUT); //Red LED as output 14 pinMode(buzzer, OUTPUT); //Buzzer as output 15 digitalWrite(buzzer, HIGH); //Turn Buzzer on 16 17} 18 19void loop() { //Loop code 20 21 digitalWrite(blueLED1, HIGH); //Blue led on 22 delay(50); //wait for 1/25 of a second 23 digitalWrite(blueLED1, LOW); //Blue led off 24 digitalWrite(yellowLED2, HIGH); //Yellow led on 25 delay(50); //wait for 1/25 of a second 26 digitalWrite(yellowLED2, LOW); //Yellow led off 27 digitalWrite(greenLED3, HIGH); //Green led on 28 delay(50); //wait for 1/25 of a second 29 digitalWrite(greenLED3, LOW); //Green led off 30 digitalWrite(redLED4, HIGH); //Red led on 31 delay(50); //wait for 1/25 of a second 32 digitalWrite(redLED4, LOW); //Red led off 33 digitalWrite(greenLED3, HIGH); //Green led on 34 delay(50); //wait for 1/25 of a second 35 digitalWrite(greenLED3, LOW); //Green led off 36 digitalWrite(yellowLED2, HIGH); //Yellow led on 37 delay(50); //wait for 1/25 of a second 38 digitalWrite(yellowLED2, LOW); //Yellow led off 39 40} 41
MulticoloredLEDStreamWithBuzzer.ino
c_cpp
Copy and paste this into the IDE
1//Digital Pins/Variables 2int blueLED1 = 2; //Blue LED to Pin 2 3int yellowLED2 = 3; //Yellow LED to Pin 3 4int greenLED3 = 4; //Green LED to Pin 4 5int redLED4 = 5; //Red LED to pin 5 6int buzzer = 6; //Buzzer to pin 6 7 8void setup() { //Setup Code 9 10 pinMode(blueLED1, OUTPUT); //Blue LED as output 11 pinMode(yellowLED2, OUTPUT); //Yellow LED as output 12 pinMode(greenLED3, OUTPUT); //Green LED as output 13 pinMode(redLED4, OUTPUT); //Red LED as output 14 pinMode(buzzer, OUTPUT); //Buzzer as output 15 digitalWrite(buzzer, HIGH); //Turn Buzzer on 16 17} 18 19void loop() { //Loop code 20 21 digitalWrite(blueLED1, HIGH); //Blue led on 22 delay(50); //wait for 1/25 of a second 23 digitalWrite(blueLED1, LOW); //Blue led off 24 digitalWrite(yellowLED2, HIGH); //Yellow led on 25 delay(50); //wait for 1/25 of a second 26 digitalWrite(yellowLED2, LOW); //Yellow led off 27 digitalWrite(greenLED3, HIGH); //Green led on 28 delay(50); //wait for 1/25 of a second 29 digitalWrite(greenLED3, LOW); //Green led off 30 digitalWrite(redLED4, HIGH); //Red led on 31 delay(50); //wait for 1/25 of a second 32 digitalWrite(redLED4, LOW); //Red led off 33 digitalWrite(greenLED3, HIGH); //Green led on 34 delay(50); //wait for 1/25 of a second 35 digitalWrite(greenLED3, LOW); //Green led off 36 digitalWrite(yellowLED2, HIGH); //Yellow led on 37 delay(50); //wait for 1/25 of a second 38 digitalWrite(yellowLED2, LOW); //Yellow led off 39 40} 41
Downloadable files
Circuit Schematic
Digital IO pins are color coded based off of the color of the LED pin
Circuit Schematic

Comments
Only logged in users can leave comments