Lab 1 - Blinking LED

Posted by emily

emily's picture

Description

Use the Arduino to control a light emitting diode and change the rate at which it blinks.

Components Used

  • Light Emitting Diode (LED)
  • Resistor

Arduino Code

/*
  Blink
  Turns on an LED on for one second, then off for five seconds, repeatedly.
 
  This example code is in the public domain.
 */
 
void setup() {                
  // initialize the digital pin as an output.
  pinMode(13, OUTPUT);     
}
 
void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(5000);              // wait for five seconds
}
 
blink
5
Your rating: None Average: 5 (1 vote)