loading

In this instructable I will be showing you how to write your very first program for the arduino (Duemilanove).
Just follow the steps and as you go to the end, you will have written your first arduino program!

This is a tutorial for beginners who have never used the arduino and have just bought it or are willing to buy it....so if you know a little about the arduino, then just cope with me....

I will be teaching you how to set up a programmable LED with your arduino.

So lets get started!

Step 1: Materials


Materials Required :

Arduino Duemilanove
USB to Arduino cable
An LED (Could be a multi color one as well...but the multicolored one with only 2 leads, because the 4 lead ones are a bit different)

Tools/Equipment required:

A computer (Windows or Mac or Linux)
Internet connection (To download the program)

Step 2: Downloading the Program


Go to the arduino website : http://www.arduino.cc/
And go to the downloads section and select the appropriate download, and then install it.

And try to get the latest version, because the older ones have bugs and are a bit different.

Step 3: Running the Program


After downloading and installing it, you will have something like in the picture.
Open the .exe file, and then the arduino compiler will open up.

If the compiler opened up without any problem, then you are good to go!

If not then try re-downloading and re-installing, and if it still does not work, then download an older (More stable) version.

Step 4: Knowing the Arduino


Have a look at the pictures and you can see all the differnt parts of the Arduino Duemilanove.

The main parts are :

The ATmega processor
The Reset switch
The sockets (USB and 9V power supply)
The Analog pins
The Digital pins

Step 5: Knowing the LED

LED is an abbreviation for Light Emmiting Diode, which means it basically is a diode that gives out light.

The LED has 2 leads, the + and the - (As you can see in the picture)
The + is a little longer than the -.

It is the most common and the cheapest way to light something up!
100 LEDs cost only 2$ on ebay!

Step 6: Knowing the Cable


The arduino is connected to the pc by either of 2 ways...one is just by using a basic wire to connect both of them as shown in the picture.

Another way is to use a Bluetooth Transciever to connect to the computer wirelessly.
This is a little more advanced and not required for this project.

Step 7: Writing the Program


This is the program to control the LED on how long it stays on and how long it stays off.

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
*/

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}

Every arduino code has a "Void setup" and a "Void loop"
"Void Setup" is basically what the arduino does once it is turned on, and then once it finishes it, it goes on to "Void Loop"
And what "Void Loop" does is, it keeps repeating itself again and again and again until the arduino is turned off.

The code was taken from Arduino-Examples-Blink

Step 8: Wiring the Hardware


Now that you have the code ready, you will need to wire up the components to the arduino.

We take the LED and connect it to Pin 13 and Gnd beside it. The + goes to Pin 13 and - to Gnd.
We use pin 13 because it has an inbuilt resistor and we can just hook up and LED to that pin, whereas for other pins, we need to add an external resistor to the LED.

Once that is done, you connect the cable to the socket and to the USB, and you are done with the Hardware!!!

Step 9: Settings


Once you have the program typed up, then you go to Tools-Board- and select the correct Board
Then you go to Tools-Serial Port- and select the correct serial port, for most users its going to be COM3 or COM4.

And once that is done, you click the arrow pointing to the right, which says upload, and then your program will be uploaded to the arduino!

Step 10: Finishing and Enjoyment!


And by the last step you will have finished making your very first arduino program and using it!

Now you can change the Delay (1000) to somthing else because 1000 is a second (1000 milli seconds)
So if you write 500 instead of 1000 then the LED will stay on for half a second and so on...

Hope this tutorial has helped you write up your very first arduino program!

Note - This works with any colored LEDs, I used Blue, Red and Green in the pictures!
<p>can u help me to connect 3 h bridge(l293d) with arduino duemilanove ?? my email id : tonydavis1995@gmail.com . </p>
<p>i have arduino duemilanove i am using a mpu 6050 sensor as here: </p><p><a href="http://robot-kit.ru/images/product_images/info_images/GY521-MPU6050.png" rel="nofollow">http://robot-kit.ru/images/product_images/info_ima...</a></p><p>And the board is here: </p><p><a href="http://www.robosoftsystems.co.in/roboshop/index.php/arduino.html" rel="nofollow">http://www.robosoftsystems.co.in/roboshop/index.ph...</a></p><p>I programmed a lot many times using this sensor (mpu 6050) but didnot <br>give me any problem. But one day after plugging board it gave message <br>could not find the hardware &amp; when enquired got to know that FTDI <br>chip it was getting very hot so probably i had to get a new board. I <br>did get a new one same board (arduino duemilanove). But when i posted <br>question in the forum about this people told me that the mpu sensor took <br> a lot of current from the 3.3v pin which comes from FTDI chip. But <br>many of them on web i have seen have no problem when they have used <br>this same sensors directly plugging it to their boards &amp; nor did <br>they use any external supply to the sensor then, why is this problem <br>with my borad?</p><p></p>
<p>i have arduino duemilanove i am using a mpu 6050 sensor as here: </p><p><a href="http://robot-kit.ru/images/product_images/info_images/GY521-MPU6050.png" rel="nofollow">http://robot-kit.ru/images/product_images/info_ima...</a></p><p>And the board is here: </p><p><a href="http://www.robosoftsystems.co.in/roboshop/index.php/arduino.html" rel="nofollow">http://www.robosoftsystems.co.in/roboshop/index.ph...</a></p><p>I programmed a lot many times using this sensor (mpu 6050) but didnot <br>give me any problem. But one day after plugging board it gave message <br>could not find the hardware &amp; when enquired got to know that FTDI <br>chip it was getting very hot so probably i had to get a new board. I <br>did get a new one same board (arduino duemilanove). But when i posted <br>question in the forum about this people told me that the mpu sensor took <br> a lot of current from the 3.3v pin which comes from FTDI chip. But <br>many of them on web i have seen have no problem when they have used <br>this same sensors directly plugging it to their boards &amp; nor did <br>they use any external supply to the sensor then, why is this problem <br>with my borad?</p><p></p>
<p>i have arduino duemilanove i am using a mpu 6050 sensor as here: </p><p><a href="http://robot-kit.ru/images/product_images/info_images/GY521-MPU6050.png" rel="nofollow">http://robot-kit.ru/images/product_images/info_ima...</a></p><p>And the board is here: </p><p><a href="http://www.robosoftsystems.co.in/roboshop/index.php/arduino.html" rel="nofollow">http://www.robosoftsystems.co.in/roboshop/index.ph...</a></p><p>I programmed a lot many times using this sensor (mpu 6050) but didnot <br>give me any problem. But one day after plugging board it gave message <br>could not find the hardware &amp; when enquired got to know that FTDI <br>chip it was getting very hot so probably i had to get a new board. I <br>did get a new one same board (arduino duemilanove). But when i posted <br>question in the forum about this people told me that the mpu sensor took <br> a lot of current from the 3.3v pin which comes from FTDI chip. But <br>many of them on web i have seen have no problem when they have used <br>this same sensors directly plugging it to their boards &amp; nor did <br>they use any external supply to the sensor then, why is this problem <br>with my borad?</p><p></p>
<p>i have arduino duemilanove i am using a mpu 6050 sensor as here: </p><p><a href="http://robot-kit.ru/images/product_images/info_images/GY521-MPU6050.png" rel="nofollow">http://robot-kit.ru/images/product_images/info_ima...</a></p><p>And the board is here: </p><p><a href="http://www.robosoftsystems.co.in/roboshop/index.php/arduino.html" rel="nofollow">http://www.robosoftsystems.co.in/roboshop/index.ph...</a></p><p>I programmed a lot many times using this sensor (mpu 6050) but didnot <br>give me any problem. But one day after plugging board it gave message <br>could not find the hardware &amp; when enquired got to know that FTDI <br>chip it was getting very hot so probably i had to get a new board. I <br>did get a new one same board (arduino duemilanove). But when i posted <br>question in the forum about this people told me that the mpu sensor took <br> a lot of current from the 3.3v pin which comes from FTDI chip. But <br>many of them on web i have seen have no problem when they have used <br>this same sensors directly plugging it to their boards &amp; nor did <br>they use any external supply to the sensor then, why is this problem <br>with my borad?</p><p></p>
<p>i have arduino duemilanove i am using a mpu 6050 sensor as here: </p><p><a href="http://robot-kit.ru/images/product_images/info_images/GY521-MPU6050.png" rel="nofollow">http://robot-kit.ru/images/product_images/info_ima...</a></p><p>And the board is here: </p><p><a href="http://www.robosoftsystems.co.in/roboshop/index.php/arduino.html" rel="nofollow">http://www.robosoftsystems.co.in/roboshop/index.ph...</a></p><p>I programmed a lot many times using this sensor (mpu 6050) but didnot <br>give me any problem. But one day after plugging board it gave message <br>could not find the hardware &amp; when enquired got to know that FTDI <br>chip it was getting very hot so probably i had to get a new board. I <br>did get a new one same board (arduino duemilanove). But when i posted <br>question in the forum about this people told me that the mpu sensor took <br> a lot of current from the 3.3v pin which comes from FTDI chip. But <br>many of them on web i have seen have no problem when they have used <br>this same sensors directly plugging it to their boards &amp; nor did <br>they use any external supply to the sensor then, why is this problem <br>with my borad?</p><p></p>
<p>i have arduino duemilanove i am using a mpu 6050 sensor as here: </p><p><a href="http://robot-kit.ru/images/product_images/info_images/GY521-MPU6050.png" rel="nofollow">http://robot-kit.ru/images/product_images/info_ima...</a></p><p>And the board is here: </p><p><a href="http://www.robosoftsystems.co.in/roboshop/index.php/arduino.html" rel="nofollow">http://www.robosoftsystems.co.in/roboshop/index.ph...</a></p><p>I programmed a lot many times using this sensor (mpu 6050) but didnot <br>give me any problem. But one day after plugging board it gave message <br>could not find the hardware &amp; when enquired got to know that FTDI <br>chip it was getting very hot so probably i had to get a new board. I <br>did get a new one same board (arduino duemilanove). But when i posted <br>question in the forum about this people told me that the mpu sensor took <br> a lot of current from the 3.3v pin which comes from FTDI chip. But <br>many of them on web i have seen have no problem when they have used <br>this same sensors directly plugging it to their boards &amp; nor did <br>they use any external supply to the sensor then, why is this problem <br>with my borad?</p><p></p>
Could you help me on one more thing..? <br> <br>Can you just explain to me how we could program a cube of LED using the Arduino instead of just a one...?? <br> <br>I would also appreciate getting your email Id for easy communication if you don't mind.. <br> <br>Thanks in Advance for looking into it.. <br>!!
<p>You might need multiplexer if your LEDs are more than arduino output pins.Get one first.</p>
So are there any particular steps to be followed before modifying the existing program in the arduino like demounting or something?
nope, you can just write up the new program and then upload it, no need to demount or disconnect the arduino
BY the way.. It was really helpful..!!!! <br>I owe you a lot.!! <br>Planning to make this for the Science exhibition !! <br> <br>Thanks a lot!!
Glad you liked it :)
So with the coding, is all the description necessary, or is it just for description?
is the language the same as the arduino uno?
Sure !!
It sure is :D <br>
awesome ible this is exactly what i needed
Glad you liked it! :)<br>
Frys I think now carries the Osepp uno, which is supposed to be a clone of the Arduino. (i.e. save shipping costs by getting it local). Received one for the birthday, but have not had a chance to play with it yet. Duemilanove = 2009.
Well I still prefer the duemilanove over the uno and the mega....and I have both a duemilanove and a uno, but I don't really like the uno, so I used the duemilanove...
Why do you prefer the duemilanove over the uno? What's the advantage?
I think that you can use more @hacks@ and @mods@ for the arduino duemilanove which allows you to do loads more things and u can also double the number of ports in some cases whereas with an uno u cannot :)
osepp has several models, I not sure which ones they are though.
Cool! I might take a look!<br>How did you like my ible?
I think what coolguy111222 says should answer your question.
Thanks!<br>
Pretty awesome<br>
Cl! Thx!
This is perfect for a beginner for me!<br>Thanks a lot! Very well done and appreciated!

About This Instructable

39,011views

46favorites

License:

Bio: A programming enthusiast. I tinker around with everything I see and love to game.
More by vishalapr:Diffused Glue Stick Lamp ATtiny85 POV Display Artoo [R2] (ATtiny2313 Wall Avoiding Robot) 
Add instructable to: