Activity C2 — Blink (the delay function)


Level 3 — Blink a pattern
Complete the challenge
void setup() {
pinMode(12, OUTPUT); // set up pin 12 as an output.
}
void loop() {
digitalWrite(12, HIGH); // turn the LED on
delay(1000); // wait for 1 second
digitalWrite(12, LOW); // turn the LED off
delay(1000); // wait for 1 second
}

Inside the loop()
function you will need 8 lines of code. Copy the four lines you have and paste them right after the last delay(1000)
.
Now change two of the delays.
Your loop
function needs to look like this before you start changing the delays:
void loop() {
digitalWrite(12, HIGH); // turn the LED on
delay(1000); // wait for 1 second
digitalWrite(12, LOW); // turn the LED off
delay(1000); // wait for 1 second
digitalWrite(12, HIGH); // turn the LED on
delay(1000); // wait for 1 second
digitalWrite(12, LOW); // turn the LED off
delay(1000); // wait for 1 second
}
Change the last two delays to delay(500)
.