Arduino blinking LED Sketch

Friday, May 8, 2009 ·

I've been experimenting with the Arduino Diecimila programmable controller for about a year and a half now and one of the things I reference regularly is a basic program that blinks the on-board LED. It's perfect for running an operations test on the board, demonstrating the board, and sharing how easily it is for beginners to get started with programmable controllers. Here's the code that you can copy and paste:

/* Blinking LED */

int ledPin = 13; // Assign LED to digital pin 13, on-board LED

void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as an output
}
void loop()
{
digitalWrite(ledPin, HIGH); // turns the LED on
delay(1000);                // pause for one second
digitalWrite(ledPin, LOW);  // turns the LED off
delay(1000);                // pause for one second
}
Curious about the Arduino? Check out my Give Us One Minute post for more information and a couple of instructional videos I put together.

Technorati Tags: , , , , , ,

0 additional notes:

Post a Comment

Follow Doc

Subscribe via Email Subscribe via RSS

Follow Doc on FriendFeed

Learn Something? Tip Doc.

Recommended