Basics of the Arduino (Duemilanove)

Содержание

license

Diffused Glue Stick Lamp

ATtiny85 POV Display

Artoo [R2] (ATtiny2313 Wall Avoiding Robot)

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

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)

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!

Make It Glow Challenge

Pocket-Sized Contest

The Mad Science Fair

Be the First to Share

Did you make this project? Share it with us!

Recommendations

*6 WAYS* to Make a Cardboard Robot Costume REALLY Robotic

Motion Galaxy Lamp

 Lighted 3D Moon Phase Clock

Vintage Mini Amp

Micro:bit Contest

Organization Contest

Audio Challenge

30 Comments

TonyD8

can u help me to connect 3 h bridge(l293d) with arduino duemilanove ?? my email id : tonydavis1995@gmail.com .

dishak

i have arduino duemilanove i am using a mpu 6050 sensor as here:

And the board is here:

I programmed a lot many times using this sensor (mpu 6050) but didnot
give me any problem. But one day after plugging board it gave message
could not find the hardware when enquired got to know that FTDI
chip it was getting very hot so probably i had to get a new board. I
did get a new one same board (arduino duemilanove). But when i posted
question in the forum about this people told me that the mpu sensor took
a lot of current from the 3.3v pin which comes from FTDI chip. But
many of them on web i have seen have no problem when they have used
this same sensors directly plugging it to their boards nor did
they use any external supply to the sensor then, why is this problem
with my borad?

dishak

i have arduino duemilanove i am using a mpu 6050 sensor as here:

And the board is here:

I programmed a lot many times using this sensor (mpu 6050) but didnot
give me any problem. But one day after plugging board it gave message
could not find the hardware when enquired got to know that FTDI
chip it was getting very hot so probably i had to get a new board. I
did get a new one same board (arduino duemilanove). But when i posted
question in the forum about this people told me that the mpu sensor took
a lot of current from the 3.3v pin which comes from FTDI chip. But
many of them on web i have seen have no problem when they have used
this same sensors directly plugging it to their boards nor did
they use any external supply to the sensor then, why is this problem
with my borad?

dishak

i have arduino duemilanove i am using a mpu 6050 sensor as here:

And the board is here:

I programmed a lot many times using this sensor (mpu 6050) but didnot
give me any problem. But one day after plugging board it gave message
could not find the hardware when enquired got to know that FTDI
chip it was getting very hot so probably i had to get a new board. I
did get a new one same board (arduino duemilanove). But when i posted
question in the forum about this people told me that the mpu sensor took
a lot of current from the 3.3v pin which comes from FTDI chip. But
many of them on web i have seen have no problem when they have used
this same sensors directly plugging it to their boards nor did
they use any external supply to the sensor then, why is this problem
with my borad?

dishak

i have arduino duemilanove i am using a mpu 6050 sensor as here:

And the board is here:

I programmed a lot many times using this sensor (mpu 6050) but didnot
give me any problem. But one day after plugging board it gave message
could not find the hardware when enquired got to know that FTDI
chip it was getting very hot so probably i had to get a new board. I
did get a new one same board (arduino duemilanove). But when i posted
question in the forum about this people told me that the mpu sensor took
a lot of current from the 3.3v pin which comes from FTDI chip. But
many of them on web i have seen have no problem when they have used
this same sensors directly plugging it to their boards nor did
they use any external supply to the sensor then, why is this problem
with my borad?

dishak

i have arduino duemilanove i am using a mpu 6050 sensor as here:

And the board is here:

I programmed a lot many times using this sensor (mpu 6050) but didnot
give me any problem. But one day after plugging board it gave message
could not find the hardware when enquired got to know that FTDI
chip it was getting very hot so probably i had to get a new board. I
did get a new one same board (arduino duemilanove). But when i posted
question in the forum about this people told me that the mpu sensor took
a lot of current from the 3.3v pin which comes from FTDI chip. But
many of them on web i have seen have no problem when they have used
this same sensors directly plugging it to their boards nor did
they use any external supply to the sensor then, why is this problem
with my borad?

dishak

i have arduino duemilanove i am using a mpu 6050 sensor as here:

And the board is here:

I programmed a lot many times using this sensor (mpu 6050) but didnot
give me any problem. But one day after plugging board it gave message
could not find the hardware when enquired got to know that FTDI
chip it was getting very hot so probably i had to get a new board. I
did get a new one same board (arduino duemilanove). But when i posted
question in the forum about this people told me that the mpu sensor took
a lot of current from the 3.3v pin which comes from FTDI chip. But
many of them on web i have seen have no problem when they have used
this same sensors directly plugging it to their boards nor did
they use any external supply to the sensor then, why is this problem
with my borad?

adityapvarma

Could you help me on one more thing.

Can you just explain to me how we could program a cube of LED using the Arduino instead of just a one.

I would also appreciate getting your email Id for easy communication if you don’t mind..

Thanks in Advance for looking into it..
!!

zhaoyou.huang.9

Reply 7 years ago on Step 10

You might need multiplexer if your LEDs are more than arduino output pins.Get one first.

adityapvarma

So are there any particular steps to be followed before modifying the existing program in the arduino like demounting or something?

vishalapr

Reply 8 years ago on Step 10

nope, you can just write up the new program and then upload it, no need to demount or disconnect the arduino

adityapvarma

BY the way.. It was really helpful.
I owe you a lot.
Planning to make this for the Science exhibition !!


Источник: www.instructables.com