3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Arduino Tutorial Bundle .:Arduino Experimentation Kit:. (ARDX)

Step 3.:Getting Started:. (Blinking LED) - CIRC01

.:Getting Started:. (Blinking LED) - CIRC01
«
  • CIRC01-square.jpg
  • CIRC01-assembled.jpg
  • CIRC01-pieces.jpg
  • CIRC01-3d.png
  • CIRC01-3dexploded.png
  • CIRC01-scem.png
  • CIRC01-sheet.png

What We're Doing:
LEDs (light emitting diodes) are used in all sorts of clever things which is why we have included them in this intro. We will start off with something very simple, turning one on and off, repeatedly, producing a pleasant blinking effect. To get started grab the parts listed below, pin the layout sheet to your breadboard and then plug everything in. Once the circuit is assembled you'll need to upload the program. To do this plug the Arduino board into your USB port. Then select the proper port in Tools > Serial Port > (the comm port of your Arduino). Next upload the program by going to File > Upload to I/O Board (ctrl+U). Finally bask in the glory and possibility that controlling lights offers.

If you are having trouble uploading, a full trouble shooting guide can be found here:
(you can also download the breadboard layout sheet from the bottom of this step)

The Parts:
  • CIRC-01 (Getting Started) Breadboard Sheet (x1)
  • 2 Pin Header (x4)
  • 10mm LED (x1)
  • 560 Ohm Resistor (green-blue-brown) (x1)
  • wire

The Circuit and Plugging Everything In:
A Small Video of Everything Being Plugged in


The Code:
goto the Arduino IDE (program) and go file > examples > digital > Blink or copy the code below and paste it into an empty sketch file
/* * Blink * * The basic Arduino example.  Turns on an LED on for one second, * then off for one second, and so on...  We use pin 13 because, * depending on your Arduino board, it has either a built-in LED * or a built-in resistor so that you need only an LED. * * http://www.arduino.cc/en/Tutorial/Blink */int ledPin = 13;                // LED connected to digital pin 13void setup()                    // run once, when the sketch starts{  pinMode(ledPin, OUTPUT);      // sets the digital pin as output}void loop()                     // run over and over again{  digitalWrite(ledPin, HIGH);   // sets the LED on  delay(1000);                  // waits for a second  digitalWrite(ledPin, LOW);    // sets the LED off  delay(1000);                  // waits for a second}

Not Working?
  • LED Not Lighting Up - LEDs will only work in one direction. Try taking it out and twisting it 180 degrees. (no need to worry, installing it backwards does no permanent harm)
  • Program Not Uploading - This happens sometimes, the most likely cause is a confused serial port, you can change this in tools>serial port>
  • Still No Success? - A broken circuit is no fun, send us an e-mail and we will get back to you as soon as we can. help@oomlout.com

Making it Better:

Changing the pin:
The LED is connected to pin 13 but we can use any of the Arduino's pins. To change it take the wire plugged into pin 13 and move it to a pin of your choice (from 0-13) (you can also use analog 0-5 analog 0 is 14...)

Then in the code change the line:
 int ledPin = 13; -> int ledPin = newpin;

Then upload the sketch: (ctrl-u)

Change the Blink Time:
Unhappy with one second on one second off?

In the code change the lines:
digitalWrite(ledPin, HIGH);   delay(time on);  //(seconds * 1000) digitalWrite(ledPin, LOW); delay(time off); //(seconds * 1000)

Control the Brightness:
Along with digital (on/off) control the Arduino can control some pins in an analog (brightness) fashion. (more details on this in later circuits). To play around with it.

Change the LED to pin 9: (also change the wire)
ledPin = 13; -> int ledPin = 9;
Replace the code inside the { }'s of loop() with this:
analogWrite(ledPin, new number);
(new number) = any number between 0 and 255.
0 = off, 255 = on, in between = different brightness

Fading:
We will use another included example program. To open go to.

File > Sketchbook > Examples > Analog > Fade

Then upload to your board and watch as the LED fades in and then out.

Links:
Looking for more details or perhaps the concepts explained in another way, the internet has loads of Arduino references here are a few for this circuit


CIRC01-sheet.pdf(630x810) 42 KB
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
406
Followers
14
Author:oomlout