Saturday, April 26, 2014

Arduino Basics 1: Blinking LED

Objective:
Turn an LED on for 1 second, off for 1 second, and continue repeating.

Parts:
LED
330 Ohm Resistor


Sketch:
void setup()
{
   pinMode(13, OUTPUT);
}

void loop()
{
   digitalWrite(13, HIGH); 
   delay(1000);            
   digitalWrite(13, LOW);   
   delay(1000);
}

Analysis:
The LED [Connected to pin number 13] turns on [HIGH] for 1 second [delay(1000)]. After that, it turns off [LOW] for 1 second [delay(1000)].


No comments:

Post a Comment