Lab 1: LED blinking waltz

jennifer_wang's picture

Description

I modified the standard blinking LED program so that it will blink 1 long and 2 short, all with equally spaced downbeats (i.e. when the LED turns on) like a waltz.

 

Components used

  • Blue LED
  • 220 ohm resistor

 

Code

/*
  Blink
  Turns on an LED on for three times, one long, and two short, like a waltz.
 */
 
void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     
}
 
void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(500);              // wait for half second
  digitalWrite(13, LOW);    // set the LED off
  delay(100);              // wait for tenth second
  digitalWrite(13, HIGH);   // set the LED on
  delay(100);              // wait for tenth second
  digitalWrite(13, LOW);    // set the LED off
  delay(500);              // wait for half second
  digitalWrite(13, HIGH);   // set the LED on
  delay(100);              // wait for tenth second
  digitalWrite(13, LOW);    // set the LED off
  delay(500);              // wait for half second
}
Lab1_circuit_0.jpg
0
Your rating: None