Lab – 1 – Alternating Lights

After the initial blink set up, I worked towards setting up two different LEDs to blink alternately.

2 LED
2 Resistors (220Ω)
Jumper wire
1 Arduino
1 Breadboard

##Code##
// the setup function runs once when you press reset or power the board
void setup() {
 // initialize digital pin 13 as an output.
 pinMode(13, OUTPUT);
 pinMode(12, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
 digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
 digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
 delay(500); // wait for .5 seconds
 digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
 digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
 delay(500); // wait for .5 seconds
}

IMG_7247 IMG_7246

Leave a Reply