Description: Lab1 required us to create a blinking light. I had so much fun with the lab that I decided to try to get all three blinking lights synchronized in some kind of rythmn.
In the end, I tried to emulate the beat of a song that I was listening to while I did this lab. Here's a link to the youtube video of the final results:
http://www.youtube.com/watch?v=o_49-ls_qwY
Components Used:
- Arduino Uno
- Bread Board
- 4 wires
- 3 led lights- 1 blue, 1 red, 1 green,
- 3 220-ohm resisitors
The code to my ardruino program is below (note: I couldn't upload a file with an .ino extension.)
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
int led2 = 11;
int led3 = 4;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
delay(200); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(200);
digitalWrite(led, HIGH);
delay(200);
digitalWrite(led, LOW);
delay(500);
digitalWrite(led2, LOW);
delay(200); // wait for a second
digitalWrite(led2, HIGH);
delay(200);
digitalWrite(led, LOW);
delay(200);
digitalWrite(led3, LOW);
delay(500);
}
- Login to post comments