Arduino Starter Series - A Blinking LED

This is a project from my Arduino starter series.

In this project I'm going to make a connect a single LED on a breadboard connected to an Arduino Uno. This project is ideal for beginners who have grasped the basics of Arduino programming and prototyping but wish to learn something a little more advanced. Enjoy!

Project Requirements

Arduino Uno/Duemilanove/Diecimila
USB cable to program Arduino
Breadboard
One LED (Any colour will do)
One 220 Ohm Resistor
Wires to power the components on the breadboard

The Breadboard Setup

The Blinking LED Sketch

Arduino Sketch

As usual, I've commented the code as mush as possible to explain every line.

int LED_PIN = 8; // This should correspond to the connection from the LED to the Arduino

// Do all the initial setup in this function
void setup() {  
  pinMode(LED_PIN, OUTPUT); // Tell the Arduino that this pin requires power
}

// The loop function repeats itself
void loop() {  
  digitalWrite(LED_PIN, HIGH); // Send power to the pin by passing HIGH
  delay(1000); // Wait 1000 milliseconds (1 second)
  digitalWrite(LED_PIN, LOW); // Stop power to the pin by passing LOW
  delay(1000); // Wait 1000 millisecond (1 second);
}

Project code available on Github

Comments

comments powered by Disqus