View
228
Download
0
Category
Preview:
Citation preview
8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
1/23
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Introduction
Do you have everything you need?
Arduino TutorialLesson 1: Let there be blink!
Intro
Starting
Lesson 0
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
ladyada.net Search
Ah yes, it is f inally time to make your Arduino do something! We're going to start with the classic hello world!of
electronics, a blinking light.
This lesson will basically get you up and running using the Arduino software and uploading a sketch to the Arduino board.
Once you've completed this step we can continue to the really exciting stuff, which is when we start writing our own
sketches!
These instructions mostly show Windows software. Except when indicated, the software (should be) identical on allplatforms. Linux will be added once I figure out how to get it working (yay)
Not much is needed for this lesson, just a USB cable and an Arduino. If you have an older Arduino you may also need an
LED. Any LED is fine as long as it looks sorta like the photo, with a plastic bulb and two legs
Make sure you've gone through Lesson 0first!
April 27, 2012 11:17
Home About Projects Learn Library Blog Store Forums
http://www.ladyada.net/learn/arduino/lesson1.htmlhttp://www.ladyada.net/learn/arduino/index.htmlhttp://en.wikipedia.org/wiki/Hello_worldhttp://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.ladyada.net/learn/arduino/index.htmlhttp://www.ladyada.net/learn/arduino/starterpack.htmlhttp://www.ladyada.net/learn/arduino/lesson0.htmlhttp://www.ladyada.net/learn/arduino/lesson1.htmlhttp://www.ladyada.net/learn/arduino/lesson2.htmlhttp://www.ladyada.net/learn/arduino/lesson3.htmlhttp://www.ladyada.net/learn/arduino/lesson4.htmlhttp://www.ladyada.net/learn/arduino/lesson5.htmlhttp://en.wikipedia.org/wiki/Hello_worldhttp://www.ladyada.net/learn/arduino/lesson0.htmlhttp://www.ladyada.net/http://www.ladyada.net/about.htmlhttp://www.ladyada.net/make/http://www.ladyada.net/learn/http://www.ladyada.net/library/http://www.adafruit.com/blog/http://www.adafruit.com/http://forums.adafruit.com/8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
2/23
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Download the Software
#6 - LEDs
LCDs
Eth + SD
HELP!!!
Buy stuff
Forums
Assembled Arduino board, preferrably a
Diecimila (or whatever the latest version is)Adafruit
$35
USB Cable. Standard A-B cable is required.
Any length is OK.
Adafruit
Or any
computer
supply
store
$5
LED - Optional
Nearly any LED is OK, as long as it has
two wire legs. This part is only requiredfor NG rev cArduinos (and maybe other
older ones). Diecimila Arduino's have this
part 'built-in'
Any
electronicssupply
store
$1
The first thing to do is download the Arduino software.
Go to the Arduino Softw are Download pageand grab the right file for your OS. As of Sept 2007 the version is 009but
you should use whatever is most recent.
http://www.ladyada.net/learn/arduino/lcd.htmlhttp://www.ladyada.net/learn/arduino/LEDs.htmlhttp://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.ladyada.net/learn/arduino/LEDs.htmlhttp://www.ladyada.net/learn/arduino/lcd.htmlhttp://www.ladyada.net/learn/arduino/ethfiles.htmlhttp://www.ladyada.net/learn/arduino/help.htmlhttp://www.adafruit.com/index.php?main_page=index&cPath=17http://forums.ladyada.net/http://www.ladyada.net/images/parts/attiny2313dip.jpghttp://www.adafruit.com/index.php?main_page=product_info&cPath=17&products_id=50http://www.ladyada.net/images/parts/10MHzcermosc.jpghttp://www.adafruit.com/index.php?main_page=product_info&products_id=62http://www.arduino.cc/en/Main/Software8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
3/23
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Unpack and Install
The packages are quite large, 30-50 MB so it may take a while to finish
Extract the package onto the Desktop
Windows
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
4/23
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Mac OS X
Windows
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
5/23
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Startup!
Mac OS X
Double click the Arduino software icon
Windows
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
6/23
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Mac OS X
To open up the workspace
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
7/23
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Select chip
I think I get the red error text shown because I already have Arduino installed. Either way, it isn't a problem if you do or
don't see it.
The first step is to configure the Arduino software for the correct chip. Almost all Arduinos use the ATmega168, but
there's a chance you have an ATmega8. Look for the chip on the Arduino that looks like this:
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
8/23
pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Select port
If the text says ATMEGA8-16P then you have an atmega8 chip. If the text says ATMEGA168-20P then you have an
atmega168chip. If it says "ATMEGA328P-20P" you have an atmega328p chip
Make sure the correct chip is selected (this picture is really old, will be fixed soon). This preference is saved so you only
have to set it once, the program will remember next time it's run.
Next, its time to c onfigure the Serial Port (also known as the COM Port). Go back to lesson 0to remind yourself of
which port it is. On a PC it will probably be something like COM3or COM4. On a Mac it will be something like
tty.usbserial-xxxxx
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.ladyada.net/learn/arduino/lesson0.html8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
9/23
df d mi b PRO i Are you a developer? Try out the HTML to PDF API
Open blink sketch
Windows port selection
Mac port selection
This preference is saved so you only have to set it once, the program will remember next time it's run.
However, if you have multiple Arduino's, they may be ass igned difference COM ports. So every time you plug in a new
Arduino, double check that the correct port is selected.
Sketchesare little scripts that you can send to the Arduino to tell it how to act. Let's open up an Example Sketch. Go to
the File menu -> Sketchbook -> Examples -> Digital -> Blink
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
10/23
df di b PRO i Are you a developer? Try out the HTML to PDF API
The window should now look like this, with a bunch of text in the formerly empty white space and the tab Blinkabove it
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
11/23
df di b PRO i A d l ? T t th HTML t PDF API
Verify / CompileThe first step to getting a Sketchready for transfer over to the arduino is to Verify/Compileit. That means check it over
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
12/23df di b PRO i A d l ? T t th HTML t PDF API
for mistakes (sort of like editing) and then translate it into an application that is compatible with the Arduino hardware.
After a few seconds, you should see the message Done compiling.in the Status Barand Binary Sk etch Size: in the
Notification area.This means the sketch was well-written and is ready for uploading to the Arduino board!
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
13/23df di b PRO i
Are you a developer? Try out the HTML to PDF API
Reset (NG only)To tell the Arduino that it should prepare itself for a new Sketch upload, you must reset the board. Diecimila Arduino's
h b ilt i t t bilit d 't d t d thi Old A d i h NG t b ll t
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
14/23df di b PRO iAre you a developer? Try out the HTML to PDF API
Upload
have built-in auto-reset capability, so you don't need to do anything. Older Arduinos, such as NG, must be manually reset
before uploading a sketch. To do that simply press the black button on the right hand s ide of the board, shown here.
Now it's time to upload. Make sure the Arduino is plugged in, the green light is on and the cor rect Serial Port is selected.
If you have an NG Arduino, press the Reset Buttonnow, just before you select the Uploadmenu item.
Select Upload to I/O Board from the File menu
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.ladyada.net/images/arduino/ngresetbutton.jpg8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
15/23df di b PRO iAre you a developer? Try out the HTML to PDF API
After a few seconds you should get this screen, with the message Done uploading.in the status bar.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
16/23
Are you a developer? Try out the HTML to PDF API
If you get the following error message "avrdude: stk500_getsync(): not in sync: resp=0x00"that means that the
Arduino is not responding
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
17/23
pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Then check the following:
If you have a NG Arduino, did you press reset just before selecting Uploadmenu item?
Is the correct Serial Port selected?
Is the correct driver installed?
Is the chip inserted into the Arduino properly? (If you built your own arduino or have burned the bootloader on yourself)
Does the chip have the correct bootloader on it? (If you built your own arduino or have burned the bootloader on yourself)
If you get the following error message:
It means you dont have a serial port selected, go back and verify that the correct driver is installed ( lesson 0)
and that you have the correct serial port selected in the menu.
If you get the following error Expected signature for ATMEGA
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.ladyada.net/learn/arduino/lesson0.html8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
18/23
pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Then you have either the incorrect chip selected in the Toolsmenu or the wrong bootloader burned onto the chip
If you get the following error: can't open device "COM10": The system cannot find the file specified(under
Windows, COM port value may vary)
It means that you have too many COM ports (maybe you've got 9 Arduinos?) You should make sure that the port is
numbered as low as possible. You can use a program like FTCleanto clear out old COM ports you aren't using anymore.
Once you've cleaned out the ports, you'll have to reinstall the driver again (see lesson 0).
Alternately, if you're sure that the ports are not used for something else but are left over from other USB devices, you cansimply change the COM port us ing the Device Manager. Select the USB device in the Device Manager, right click and
select Properties
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.ftdichip.com/Resources/Utilities.htm8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
19/23
pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Video of all steps
Then click Advanced... and in the next window change the COM port to something like COM4or COM5. Don't forget to
select the new port name in the Arduino software. The lower port names may say (in use) but as long as the other USB
devices aren't plugged in, it shouldn't be a problem. This is a little riskier than just us ing FTClean...
Here is a video showing the timing of the steps described so far.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
20/23
pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Insert LED (NG Arduinos)
Some older Arduinos don't have a built in LED, its easy to tell if yours does or not
If you have a Diecimila or other Arduino with a built in LED you will see a translucent part as shown
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
21/23
pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
If you have an NG rev C or other Arduino without an LED, the translucent part will not be there, and instead you will see
two silver dots
If you don't have an LED, you'll need to add your own. Any LED will do, as long as it has two legs and kinda looks like
the one shown here. LEDs are directionalcomponents. That means if you put it in backwards it will not work! To help
you put the LED in right, the LED factory cuts the legs at different lengths. The longer leg goes in the hole marked 13and
h h i h h l k d GND
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf8/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
22/23
pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
Watch!
the shorter one goes in the hole marked GND
If you have a Diecimila Arduino, the upload process is quite fast, just start the Upload from the software. The board will
automatically reset itself, transfer the sketch and start the sketch. The little translucent LED will start blinking
Click To Play
If you have an NG arduino, make sure the LED is inserted as indicated before. Here is a video of the entire uploading
process. Right after I press the Reset Button I start the sketch upload. There is a short w ait while the software prepares totransfer the sketch. Then the two small orange lights blink, indicating the sketch is being transfered. When its done, there
is a 7 second delay until the sketch starts.
Click To Play
If you don't get a blinking LED, make sure you put the part in the right way, in the correct holes, and perhaps try a
different LED as it may be bad.
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.ladyada.net/images/arduino/ngled.jpghttp://blip.tv/file/get/Ladyada-DiecimilaArduinoBlinkUpload640.flvhttp://blip.tv/file/get/Ladyada-DiecimilaArduinoBlinkUpload640.flvhttp://blip.tv/file/get/Ladyada-ArduinoNGUploadBlink905.mp4http://blip.tv/file/get/Ladyada-ArduinoNGUploadBlink905.mp48/12/2019 Www Ladyada Net Learn Arduino Lesson1 HTML
23/23
pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API
http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.ladyada.net%2flearn%2farduino%2flesson1.html&id=ma-140319170002-8bca3b1ehttp://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfRecommended