Lab 1 - Blinking LED

Chelsey's picture

Description: Create a circuit with an LED that blinks SOS in Morse code

Components: LED, resistor

Arduino code:

/*
  Blink_Chelsey_SOS
  Turns on an LED on 3 times quickly (300 ms each), then on 3 times slowly (1 s each), then on 3 times quickly (300 ms each), then pauses for 2 seconds before repeating.
 
  This code is based on code that is in the public domain.
 */

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(300);                // wait for 300 ms
  digitalWrite(13, LOW);  // set the LED off
  delay(300);                  // wait for 300 ms
  digitalWrite(13, HIGH);   // set the LED on
  delay(300);              // wait for 300 ms
  digitalWrite(13, LOW);    // set the LED off
  delay(300);              // wait for 300 ms
  digitalWrite(13, HIGH);   // set the LED on
  delay(300);              // wait for 300 ms
  digitalWrite(13, LOW);    // set the LED off
  delay(300);              // wait for 300 ms
 
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(500);              // wait for half a second
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(500);              // wait for half a second
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(500);              // wait for half a second
 
  digitalWrite(13, HIGH);   // set the LED on
  delay(300);              // wait for 300 ms
  digitalWrite(13, LOW);    // set the LED off
  delay(300);              // wait for 300 ms
  digitalWrite(13, HIGH);   // set the LED on
  delay(300);              // wait for 300 ms
  digitalWrite(13, LOW);    // set the LED off
  delay(300);              // wait for 300 ms
  digitalWrite(13, HIGH);   // set the LED on
  delay(300);              // wait for 300 ms
  digitalWrite(13, LOW);    // set the LED off
  delay(2000);              // wait for 2 seconds
}

Chelsey_Lab1.jpg
0
Your rating: None