Lab 1: Blinking LED

Submitted by MarieSpliid on Wed, 01/30/2013 - 17:05
MarieSpliid's picture

This code snippet  turns on an LED for 1 second and then turns it off for 0,5 second, repeatedly.

Components:

  • Arduino board
  • Bread board
  • LED
  • Resistor (220 ohm)
  • 2 wires
 
Code
/*
blinkingLED
 */
 
// Pin 8 has an LED connected on most Arduino boards.
// give it a name:
int led_BLUE = 8;
 
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led_BLUE, OUTPUT);     
}
 
// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led_BLUE, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for 1 second
  digitalWrite(led_BLUE, LOW);    // turn the LED off by making the voltage LOW
  delay(500);               // wait for 0,5 second
}
Blinking LED
0
Your rating: None
Drupal theme by Kiwi Themes.