You are on page 1of 14

Explore

(/) (/)

(/tag/type-id/)

Create

(/about/submit.jsp)

Contests (/contest/) let's make

Community

Login (/you/) (/community/)

share what you make > (/about/submit.jsp)

About This Instructable 72,007 views 257 favorites


gunnk (/member/gunnk/)
Follow
17

License:

(/member/gunnk/) Bio: Maker Coordinator for Maker Faire: NC Life is short: Void the warranty! Tags:
arduino (/tag/type-id/category-technology/keyw ordarduino/) tutorial (/tag/type-id/category-technology/keyw ord-

(http://cdn.instructables.com/FI2/17DH/FQCTL4VM/FI217DHFQCTL4VM.LARGE.jpg)

An all-in-one tutorial to getting started with the Arduino (http://arduino.cc/) opensource electronics prototyping platform. This guide is meant for the beginner but should be also be useful to you if you already tinker with electronics but want to get started with the Arduino. I'll cover: - breadboarding LED outputs from the Arduino - creating and reading digital inputs to the Arduino - how to program the Arduino to take the input and act on it to modify the outputs Our demonstration project will consist of a set of three blinking LED's that blink in sequence. You'll control the speed of the blinks via a pushbutton controller. I've designed this project to be modular in nature: we can create a fairly complex effect, but I've wired and coded everything in a modular fashion to make it easier to follow. Of course, that means that neither the circuits nor the code are necessarily the most efficient way of doing things -- but the emphasis here is on making it clear and understandable. Acknowledgement: I'd like to thank Lady Ada for her excellent set of tutorials on the Arduino (http://www.ladyada.net/learn/arduino/index.html) which is where I first learned Arduino basics. I cover a lot of the same ground, but her work has a very different flavor and emphasis including a different set of circuits and programs. I recommend that you pay her tutorials a visit. You can also buy Arduino boards and an wide variety of shields and accessories for the Arduino from her company, Adafruit Industries (http://www.adafruit.com/index.php). Here's how the finished project behaves:

tutorial/)

Related
How to use Arduino Mega 2560 as Arduino isp (/id/How-to-use-ArduinoMega-2560-as-Arduinoisp/) Burn Arduino Bootloader with Arduino MEGA! (/id/Burn-ArduinoBootloader-with-ArduinoMEGA/) Control Arduino Board Wirelessly With iPhone, iPad or iPod Using iArduino App and Ether (/id/Control-ArduinoWireless upload program to Arduino without USB cable (/id/Wirelessupload-program-toArduino-without-USBTurn Your Arduino Into an ISP (/id/Turn-YourArduino-Into-an-ISP/)
by mr_mac3 (/member/mr_mac3/)

See More (/tag/type-id/?q=)

Step 1: Testing Your Board / Getting Started

(http://cdn.instructables.com/FTB/68GK/FQCTIXHO/FTB68GKFQCTIXHO.LARGE.jpg)

If you have already connected an Arduino to your computer and run the basic "blink" example you can skip this step. However, if all you've done is unbox it, here's how to start: 1) Download the software you'll need from the makers: Software Download (http://arduino.cc/en/Main/Software). 2) Install the software and connect your Arduino to your computer via a USB cable. It draws power directly from the USB port, so you don't need to connect a power supply to it at this point. 3) If you have a newer board you'll see a resistor next to pin 13 and an LED next to that. That LED works just as if it were connected between pin 13 and the ground

(GND) pin next to it. If the LED is NOT on your board, just connect an LED between 13 and GND. You don't need to do anything else since a resistor is already built in and limits the current through the LED so you don't put your board at risk of a short circuit. NOTE: This resistor may not be present on really old boards (I just don't know), but I doubt you have one of those. 4) Set your board type and serial port under "Tools" in the software kit. The current version (at the time of writing) does not have an option for the newest Duemilanove boards, but choosing Diecimila works just fine. 5) Open the blink example from the software kit: It's under File | Sketchbook | Examples | Digital. The onboard LED (or the one you added) should blink on and off after you upload the Blink "sketch" (as Arduino projects are called) to the board (File | Upload). When you write programs for your Arduino, you will normally do much of your debugging in the software development kit by doing a Verify/Compile before uploading, but since we just uploading a pre-built test sketch I skipped that here.

Step 2: Wiring the Blinky Lights

(http://cdn.instructables.com/F58/7J0X/FQCTIXIK/F587J0XFQCTIXIK.LARGE.jpg)

I've broken the circuit down in such a way that we will be wiring up our output (the blinky lights) completely separately from our input (the pushbutton switch). Makes it easier to understand if you're just starting out. First, a note and word of caution. Newer Arduino boards have an LED right on the board itself or at least a resistor connected to pin 13 so that you can stick an LED right between pin 13 and ground (GND). This is NOT true for the other pins! If you connect LED's or other circuits on other pins you must be certain to protect your board from excessive currents or full-out short circuits. You can fry your Arduino! Personally, I recommend that you always use a resistor when experimenting. You don't want to accidentally short to ground, so at least connect a low value resistor to the ground pin. Better safe than sorry. In this circuit we are using pins 11,12 and 13 as digital outputs (5V) to power the

LED's. The negative post of each LED connects across a single shared resistor and then to ground. In my circuit I'm using a 150 ohm resistor (it was just a convenient grab from my parts bin). You can use other values here -- just don't go too extreme so that you don't either (a) keep the LED from lighting or (b) push too much current through your Arduino. If you run the Arduino "blink" sketch from step one you should now notice that one of your LED's is blinking. If not, you should check back over your wiring and components. A diagram for this very simple circuit is below.

Step 3: Wiring the Pushbutton Switch

(http://cdn.instructables.com/FFM/RXXL/FQCTIXIV/FFMRXXLFQCTIXIV.LARGE.jpg)

To keep things modular, the pushbutton switch also connects to your Arduino, but it's a very separate circuit. Note that the little pushbutton switches commonly available have four legs. The pins on each side are permanently connected to one another, so the button actually makes a single connection between the two sides. If you're in doubt as to which posts are which, just check it with your multimeter. In the circuit diagram you're going to notice that we are using two resistors. Again, the exact values aren't really important, but the relative values are. If you aren't familiar with the concept of pull-up/pull-down resistors, please take a minute to really understand this circuit. If you don't, you will likely get flaky results in future projects or -- worse yet -- burn out your Arduino. When the switch is OPEN, the circuit is simply a connection from the digital input (pin 2 in our case) to ground through a couple of resistors. Since we are connected to ground the value at pin 2 is LOW (approximately zero volts). If we were connected only to the switch the value would be whatever noise the wires were picking up. Maybe it would be close enough to zero to work, but maybe not. We need that ground connection to make sure our reading is right. When the switch is CLOSED, the 5V source is connected to ground across our 15k resistor. The 150 ohm resistor is negligible by comparison, so it has a minimal effect on the voltage our input pin is reading (5V) and the digital input is HIGH (~5V). The 150 ohm resistor keeps us from creating a short between the power source and the pin so that we don't damage the Arduino. Again, the exact values of these resistors are not important. Just make sure R1 is MUCH bigger than R2 and that R2 is big enough to limit the current back to the board. My values were simply plucked from my parts bin.

Clarification: The resistor is a pull-DOWN resistor because it connects the digital input to ground. A pull-UP resistor would pull the normal (no button pressed) state of the input to 5V.

Step 4: Programming the Project


Now that we have completed wiring up our project it is time to write some code. I'm including all the code below, but will talk about the theory a little first. The code I've provided compiles to 1560 bytes in size. The Arduino handles programs up to 14336 bytes in size. This little project takes up over 10% of the Arduino's capacity, but this is REALLY not optimal code. It's a tutorial, so I've tried to be clear rather than efficient. I wouldn't be at all surprised to find it could be rewritten in half the space or less. Every Arduino "sketch" has two mandatory areas: setup and loop. Setup executes ONCE after the program starts. This allows you to configure the initial state of the board: which pins are inputs, which are outputs, and whether outputs start off HIGH or LOW. The loop is the section of the program executived repeatedly as soon as setup has completed. There is no "end" or "exit" to an Arduino program -- there is nowhere to exit to! If you have experience programming, you'll immediately recognize the language used to program the Arduino is our good old buddy C. If not, you can pick up the basics just by going over my code and the other examples in the development kit. Many great C tutorials are also available on the web. You can copy and paste the code into your Arduino development environment, then verify and upload it. If everything is right you should get blinky lights and be able to vary the speed by pressing the button. Now a section-by-section breakdown of the sketch: 1) First we start by defining some variables. Much of this area is for human comprehension and could be skipped for the sake of efficiency. For example, I've defined a variable called "ledPinRed" and set it equal to 13 (I used three colors of LEDs -- the red one is connected to digital pin 13). I could have used "13" directly throughout the program, but that makes it much harder to comprehend. The comments next to the variables note what each is for. 2) Setup. Here I've set the pin to which the pushbutton is attached as an input pin. The Arduino will be looking to receive information (HIGH or LOW signals) there. I've set the LED connections to be outputs where the board will set the voltage as HIGH or LOW (5V or 0V) as appropriate. Finally, I turned on my green LED and made sure the others were turned OFF. 3) getButton: a function (just a container for code for any non-programmers reading this) that can be called from the main loop to find out if we've pressed the button. It keeps track of the current state of the button AND the previous state of the button the last time we looked at it. This allows us to respond only to individual button presses: holding down the button only counts as ONE press. This is important when the lights are changing very rapidly lest it be very tough to control. 4) changeLights: another function. This one gets called whenever we need to move from one LED to the next. The one that's on gets turned off and the next one in sequence gets turned on. It also updates the "currentLED" variable so we can keep track of which LED is currently active.

5) loop: The main loop. Here we first make a call to check on the button. If we find the button wasn't being pressed but now it is, we add to the "currentSpeed" variable. If we're going really fast, we reset currentSpeed back to 1 -- looping around so we can go back to slow speeds. After that... ...well, then we hit an ugly line that determines if it is time to change to the next LED. millis() is a built-in Arduino function that keeps track of how long the board has been running the current program. All we're doing here is finding out if enough time has gone by that we should change to the next light. If so, we call the "changeLights" function to make it happen. Finally, here is the code (warning: it loses a little formatting when posted here, so it's not as pretty as it could be): /* Kevin's Arduino Tutorial * This software is designed to be used with my Arduino All-in-One Getting Started Guide over at http://instructables.com. (http://instructables.com.) * */ // Note that these variables are all GLOBAL in scope, so they'll work inside our function calls int ledPinRed = 13; // Set up digital outputs for LEDs int ledPinYellow = 12; int ledPinGreen = 11; int switchPin = 2; // Set up to read the switch state from digital input 2 int currentLED = 1; //Green = 1, Yellow = 2, Red = 3 int currentSpeed = 1; // Determines how fast we switch between lights. int buttonWas = 0; // The state of the switch (pushed = 1, not pushed = 0) last time we looked int buttonIs = 0; // Current state of the switch unsigned long timer = 0; // A timer to keep track of where we are. void setup() // Runs once, when the program ("sketch") starts { pinMode(switchPin, INPUT); // Tells the Arduino to treat the switchPin as INPUT pinMode(ledPinRed, OUTPUT); // Tells the Arduino that the Red LED pin is for OUTPUT pinMode(ledPinYellow, OUTPUT); pinMode(ledPinGreen, OUTPUT); digitalWrite(ledPinGreen, HIGH); // Green LED is ON at start digitalWrite(ledPinRed, LOW); // Red LED is OFF at start digitalWrite(ledPinYellow, LOW); // Yellow LED is OFF at start } void getButton() { // Let's see what the button is doing, shall we? buttonWas = buttonIs; // Set the old state of the button to be the current state since we're creating a new current state. buttonIs = digitalRead(switchPin); // Read the button state } void changeLights() { // Turn OFF the currently lit LED and turn ON the next one. timer=millis(); // reset our timer to the current time if(currentLED==1) { digitalWrite(ledPinGreen, LOW); digitalWrite(ledPinYellow, HIGH);

} if(currentLED==2) { digitalWrite(ledPinYellow, LOW); digitalWrite(ledPinRed, HIGH); } if(currentLED==3) { digitalWrite(ledPinGreen, HIGH); digitalWrite(ledPinRed, LOW); } currentLED++; // Add one to currentLED if (currentLED==4) { currentLED=1; } } void loop() // This is our "main" loop. Arduino programs don't exit -- nowhere to exit TO! { getButton(); if((buttonIs==1)&&(buttonWas==0)) { currentSpeed++; // Add one to the current delay because the button was pressed. if(currentSpeed==15) { currentSpeed = 1; } // Loop around -- this sets us back to a slow rotation. } Arduino All-in-One Getting Started Guide by gunnk (/member/gunnk/) if (millis()>=timer+(1000/currentSpeed)) { // Time to change the lights! changeLights(); Download (/id/Arduino-All-in-One-Getting-Started-Guide/?download=pdf) (/id/Arduino-All-in-One-Getting-Started-Guide/) 5 Steps } } + Collection I Made it! Favorite

KevinsArduinoTutorial.cpp

(/files/orig/F4J/FMIS/FQCTL5ET/F4JFMISFQCTL5ET.tmp)2 KB

Step 5: Where to Go from Here


Congratulations! You've made it to the end of my tutorial. I'll leave you with a couple of hints plus some ideas of what you can do using this circuit as a basis. My biggest hint is the use of the Arduino software kit's serial monitor. Learn to love it. When the Arduino is running, use the serial monitor to see any information the board is sending to your computer. The command Serial.begin(9600); will tell the Arduino to send data to the computer. What data? Anything you want. Just use: Serial.print("My variable is now: "); Serial.println(myVariableName); Notice that those lines are bit different. The first doesn't add a newline on the end while the second does. Use Serial.print functions LIBERALLY when debugging code. You can delete them once everything is working correctly. Also, note that the great thing about the Arduino is that you don't have to keep it hooked to your computer once you've uploaded your sketch. However, the board

will need power. A 9V DC adapter with a positive tip is what you'll need (I keep an assortment on hand plus a couple of adjustable power supplies). If you don't have a suitable one, Adafruit Industries has them and includes one in their Arduino starter kit. So now what? You know how to wire output and input to your Arduino and have a working copy of my tutorial project. Here's a couple of ideas for you to try: 1) Add more LED's. Instead of looping from the last LED to the first, just reverse direction. The back and forth should make a decent Cylon effect. 2) Try adding a second button on another input to slow down the rate of blinking. Or maybe create entirely different patterns using your second switch (the first one is speed, the second is mode). In any case, have fun! The Arduino is a great piece of hardware with virtually unlimited applications. A little practice and a bit of imagination and the sky's the limit!

Make Comment

cdragos george (/member/cdragos+george/) 9 months ago

Reply (CT2XC17HHMI74BD)

to start using Arduino (/member/cdragos+george/)

this is a great tutorial about Arduino. also, I write a comprehensive tutorial about how boards and resources (http://www.intorobotics.com/resourcesand-tutorials-to-start-working-with-arduino-boards/).

mvanderdeen (/member/mvanderdeen/)

1 year ago

Reply (CCFIHTVH3CS31HT)

was wondering (/member/mvanderdeen/)

this may be a little late (and possibly make me sound like an idiot) but here goes, i if thats all code or if your instructions are included in the coding above?

gunnk (/member/gunnk/) (author)

Download the file at the end called "KevinsArduinoTutorial.cpp". That's (/member/gunnk/) JUST the code and you can use it as-is in the Arduino IDE (the program editor). In the text on this Instructables page, the code starts with the line: /* and ends with the final } on the page.

mvanderdeen 1 year ago

Reply (C35LL0JH2WETZ9N)

Don't worry about sounding like an idiot! If you aren't tackling new subjects where you don't know anything at all, then you aren't reaching your potential. The smartest people I know are the least afraid of looking like an idiot -- so they fearlessly ask "dumb questions" all the time!

Thanks for the help, and the motivation great instructable by the way :) (/member/mvanderdeen/)

mvanderdeen (/member/mvanderdeen/) gunnk 1 year ago

Reply (COFSYYBH2WEU10D)

toelle (/member/toelle/)

5 years ago

Reply (CPX2DWVFRXUSN4P)

Just ordered an arduino duemilanove =D Cant wait to get my hands on it :P


(/member/toelle/)

louwhopley (/member/louwhopley/)

Be careful not to roast your first one! Stick with using USB power until you're (/member/louwhopley/) pro. Enjoy :)

toelle 3 years ago

Reply (CX1T9JWG96288H0)

yaly (/member/yaly/)

louwhopley

2 years ago

Reply (C9TL348GY4RAHYB)

Egypt it was (/member/yaly/)

I have an uno that I ordered from fut-electronics.com and because I live in delivered to me for total of 165 egptian pounds that I'm afraid to loss or fry because i think my dad won't let me buy any thing else from that web-site as it was delivered an empty arduino uno box sealed and sealed cable so the i told them on the phone they sent another one with the board inside!!

toelle (/member/toelle/)

louwhopley

3 years ago

Reply (C4R7M2XG962KFTM)

make (/member/toelle/)

There's really not much that can go wrong with external power supply. Just sure you've got the right polarity, and that it is no higher than 12VDC and you should be good. But don't play with transistors :P .. I roasted 2 pins on my atmega168 by connecting transistors to it the wrong way, but I already ordered some new atmega328's :D

louwhopley (/member/louwhopley/)

Hahaha, i roasted my whole 328 :(


(/member/louwhopley/)

toelle 3 years ago

Reply (CICYTHCG96289B5)

I also ordered a new one!

toelle (/member/toelle/)

louwhopley

3 years ago

Reply (CLVQXDKG962DPZD)

Where (/member/toelle/)

i'll try to be careful not to roast my 328's when i get them :) do you order your chips from? Atleast i only roasted 2 pins (so far) on my 168, so I can still use the other pins :)

louwhopley (/member/louwhopley/)

I ordered my first Arduino from Italy which took too long so now I am (/member/louwhopley/) ordering parts from the only local store we have in South Africa. http://www.netram.co.za

toelle 3 years ago

Reply (C6XAEWBG96289F9)

dasta (/member/dasta/)

louwhopley

2 years ago

Reply (CC4Z2EMGS3BF9DE)

much. now i (/member/dasta/)

awesome!!!! i've been struggling with electronics123 cos they don't have haz a new place to gets my stuffs!!! thanks

toelle (/member/toelle/)

louwhopley

3 years ago

Reply (CKDVTNHG962OKAE)

ordering (/member/toelle/)

Okay I ordered my first arduino from www.coolcomponents.co.uk, but now im my parts from sparkfun.com .. Better prices, and more stuff :)

geckomage (/member/geckomage/)

i have 4 of the new deumilanove atmega328's hope i dont fry them xD (/member/geckomage/)

toelle 2 years ago

Reply (C4CQ1WOGVIYJRJY)

ReCreate (/member/ReCreate/)

toelle 4 years ago

Reply (CVI8E53FWEGJU78)

Yeah i am ordering one too!


(/member/ReCreate/)

Jodex (/member/Jodex/)

ReCreate

4 years ago

Reply (CQRGJR1FY3KSN5O)

to come (/member/Jodex/)

I ordered today Getting Started with Arduino kit from Makershed! Can't wait it all the way to Finland!!

ReCreate (/member/ReCreate/)

Jodex 4 years ago

Reply (CE6JQRJFY3KSN7P)

Wow Finland? I'm gonna get mine soon...eventually XD


(/member/ReCreate/)

Jodex (/member/Jodex/)

ReCreate

4 years ago

Reply (C61H902FY3KSNN4)

US to Canada (/member/Jodex/)

Mine is gonna take a liiitle more than the 3-5 days.. Someone got one from in a week... Well I just hope that I'd get mine in about one and a half week

ReCreate (/member/ReCreate/)

Jodex 4 years ago

Reply (CNCPIQEFZQ1FS0Z)

i got mine now! :D Did you?


(/member/ReCreate/)

Jodex (/member/Jodex/)

ReCreate

4 years ago

Reply (CT0FQMTFZQ1FS84)

About four (five) weeks ago... :)


(/member/Jodex/)

ReCreate (/member/ReCreate/)

Jodex 4 years ago

Reply (CP0PPAMFZQ1FUQV)

Ah :D Last month?
(/member/ReCreate/)

Jodex (/member/Jodex/)

ReCreate

4 years ago

Reply (CELU95YFZQ1G461)

Yes
(/member/Jodex/)

ReCreate (/member/ReCreate/)

Jodex 4 years ago

Reply (C79RZ4OFYTCHTW8)

What have you done with it so far?


(/member/ReCreate/)

Jodex (/member/Jodex/)

ReCreate

4 years ago

Reply (CD1KPBOFZQ1G70O)

added (/member/Jodex/)

The Blinking LED, of course :D The EMF detector is awesome invention and I a piezo buzzer to mine. And I've done some FSR (force sensing resistor) LEDs and knight rider lights and many others.. The sample code "Melody" was nice too, and of course with my own modification ;) What you have done? Do you recommend some project? I recommend warmly the EMF detector by Aaron Alai.

ReCreate (/member/ReCreate/)

Jodex 4 years ago

Reply (CKL5RY8FZQ1GBT1)

(based on melody code) (/member/ReCreate/)

The blinking LED, Getting readings from potentiometers, And even a siren! Would you like the siren code?

ReCreate (/member/ReCreate/)

Here
(/member/ReCreate/)

ReCreate 4 years ago

Reply (CYQYHHVFZQ1GBY8)

Siren.pde

(/files/orig/F9E/M8Y7/FZQ1GBY7/F9EM8Y7FZQ1GBY7.tmp)1 KB

ReCreate (/member/ReCreate/)

Jodex 4 years ago

Reply (C33A02KFY3KSPWJ)

arduino's (/member/ReCreate/)

Yeah, Where did you buy yours from?(also, Is finland near italy?(italy is where are made))

Jodex (/member/Jodex/)

ReCreate

4 years ago

Reply (C6MBHLRFY3KSTSE)

Italy pretty much at the (/member/Jodex/)

I ordered from USA Makershed. Finland is one of the Northest countries and Southest end of Europe. So it might take some time to get over the ocean and here...

ijabi (/member/ijabi/)

2 years ago

Reply (CSYC3Z3GS3BEB1S)

I need (/member/ijabi/)

Hi To All your help.I have Arduino Duemilnove but nothing happen when I plug it through USB.The first time I plugued it it went through the installation.but when I plug it now the computer does not detect it! another thing I downloaded all the drivers but when I try to unzip them ,they are kind of non-executable!?what to do .your help is greatly appreciated.Thanks again. Ijabi

robot1398 (/member/robot1398/)

2 years ago

Reply (CODE6ICGQ5PYUCT)

and i have a arduino uno


(/member/robot1398/)

robot1398 (/member/robot1398/)

2 years ago

Reply (C2JNN7LGQ5PYUCR)

do i have to reset my arduino before loding another code or i have to erase the old code or just programme the new program (/member/robot1398/) and how many pin switch did u use 4 or 2

mcmahanly (/member/mcmahanly/)

3 years ago

Reply (CBVNKPAGKS0W6W4)

somebody please (/member/mcmahanly/)

I'm completely new with programming. don't even know much about computers. Can explain to me what means what here. why am i typing int before everything. is there somewhere i can reference all of these terms?

gunnk (/member/gunnk/) (author)

I would recommend you learn a little basic programming first. Look for a (/member/gunnk/) tutorial on C as a starting point as the Arduino uses a bit of C and C++ for it's development.

mcmahanly 3 years ago

Reply (CZJPLWXGKS0W9ZN)

The "int" before the variable names defines what kind of information the variable will store. In the case of "int" it means the value will be an integer. Other common variable types are "float" for floating point (decimal) numbers and "char" for characters. There are quite a few types. The full language reference for the Arduino is here: http://arduino.cc/en/Reference/HomePage

ekhurley (/member/ekhurley/)

3 years ago

Reply (CNC1A4AGJQEK6XT)

resistor on some (/member/ekhurley/)

I just bought The getting started book and a kit, and they keep mentioning using a pins but not others, thank you for finally explaining why.

DirtMcGurt (/member/DirtMcGurt/)

4 years ago

Reply (CO9A4F3FVDC3D92)

I'm new to this stuff but wouldn't that be a pull down?


(/member/DirtMcGurt/)

gunnk (/member/gunnk/) (author)

Correct. Thanks for the catch on that. I've clarified the text now. Pull-up/Pull(/member/gunnk/) down refers to what happens when the switch is OPEN. A pull-up resistor would hold Digital Pin 2 to 5V. A pulldown resistor holds it to 0 when the switch is open. We're holding to 0V when the switch is open, so this is a pull-down resistor.

DirtMcGurt 4 years ago

Reply (COATO2BFVHQG8K2)

etni3s (/member/etni3s/)

5 years ago

Reply (CGPKDGDFS8O2S0Z)

I have a slightly different setup: both resistors are 220 ohm.


(/member/etni3s/)

The button: white - pin 2, orange - 5V, blue - ground. The diodes: All white cables are connected to ground on this part of the bread board. Connect ground to resistor and then all diodes to the other end of the resistor.

I also modified the code to fix some bugs and look better in general (in my opinion): http://pastebin.com/f4474a984 (http://pastebin.com/f4474a984) Larger pictures: 1 (http://www.instructables.com/file/FCHGNN5FS8RCU12/? size=ORIGINAL), 2 (http://www.instructables.com/file/FWH8307FS8RCU11/? size=ORIGINAL), 3 (http://www.instructables.com/file/FPJNVKFFS8RCU0U/? size=ORIGINAL).

(http://cdn.instructables.com/FWH/8307/FS8RCU11/FWH8307FS8RCU11.LARGE.jpg)

(http://cdn.instructables.com/FPJ/NVKF/FS8RCU0U/FPJNVKFFS8RCU0U.LARGE.jpg)

(http://cdn.instructables.com/FCH/GNN5/FS8RCU12/FCHGNN5FS8RCU12.LARGE.jpg)

gunnk (/member/gunnk/) (author)

The code definitely looks much cleaner! (/member/gunnk/)

etni3s 5 years ago

Reply (CTJZWJOFSFRQROB)

etni3s (/member/etni3s/)

etni3s

5 years ago

Reply (CI2RJTDFS8RCUJK)

because (/member/etni3s/)

(Note that the code says i use 5 LEDs but the pictures only show 4. This is I updated the code after I took the pictures.)

geeklord (/member/geeklord/)

5 years ago

Reply (CITQLLBFQSWZYAB)

Woo Hoo! I ordered my arduino yesterday, and i geuss its supposed to get here today...... (/member/geeklord/)

Make Comment

About Us
Who We Are (/about/) Advertise (/advertise/) Contact (/about/contact.jsp) Jobs (/community/Positions-available-at-Instructables/) Help (/community?categoryGroup=Help)

Find Us
Facebook (http://www.facebook.com/instructables) Youtube (http://www.youtube.com/user/instructablestv) Twitter (http://www.twitter.com/instructables) Pinterest (http://www.pinterest.com/instructables) Google+ (https://plus.google.com/+instructables) Tumblr (http://instructables.tumblr.com)

Resources
For Teachers (/teachers/) Artists in ResidenceJoin (/group/air/) our newsletter: Forums (/community/) enter email Gift Pro Account (/account/give?sourcea=footer) Answers (/tag/type-question/?sort=RECENT)

Mobile
Download our new apps for iOS, Android and Windows 8! Join! English

Android (https://play.google.com/store/apps/details? Terms of service (http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21959721) | id=com.adsk.instructables) Privacy Policy (http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21292079) | Legal Notices & Trademarks (http://usa.autodesk.com/legal-notices-trademarks/) | iOS Mobile Site (http://m.instructables.com) (http://usa.autodesk.com/adsk/servlet/pc/index?id=20781545&siteID=123112) (https://itunes.apple.com/app/instructables/id586765571) Copyright 2014 Autodesk Inc. All rights reserved. Windows (http://apps.microsoft.com/windows/enus/app/7afc8194-c771-441a-959054250d6a8300) Go Pro Today (/account/gopro?sourcea=footer)

We're Hiring! (/community/Positions-available-at-Instructables/)

You might also like