A1- Blinking

Posted by lizzy

Anonymous's picture

Description

Use the Arduino to control a light emitting diode and make it blink in different rate.

Components Used

  • Light Emitting Diode (LED)
  • Resistor

Arduino Code

/* Blinking LED
* ------------
*
* turns on and off a light emitting diode(LED) connected to a digital
* pin, in intervals of 2 seconds. Ideally we use pin 13 on the Arduino
* board because it has a resistor attached to it, needing only an LED

*
* Created 1 June 2005
* copyleft 2005 DojoDave <http://www.0j0.org>
* http://arduino.berlios.de
*
* based on an orginal by H. Barragan for the Wiring i/o board
*/

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code 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 bright
  delay(5000);              // wait for a 5 seconds
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // turn off for a second
}

lizzy_blink_web.jpg
5
Your rating: None Average: 5 (1 vote)