First things first, let’s upload our first program to our Arduino and make sure it works!
Connect your USB cable to your computer and to your Arduino. Sometimes people fret about this part, but you don’t have to worry about breaking it unless you’re incredibly strong and reckless.
A light on your Arduino might come on at that point (mine is far too bright).
Now open up the IDE (it’s called Arduino
on my Macbook). You’ll use the IDE to send your first program to the Arduino.
Don’t have the Arduino software on your computer? Head back to our supplies page.
Every Arduino program is called a sketch. We’re going to be using an example program called Blink.
There are two menus in Arduino, which can kind of be confusing. There’s the one that shows up on the top of your screen, and the one with the little icons. When we want you to click an icon, we’ll explain what it looks like. When we just use words, you’ll want to use the standard text menus at the very top of the screen.
You can find it by selecting File > Examples > 01.Basics > Blink
in the IDE, or by pasting the below into a new sketch.
You’ll need to tell the IDE what kind of Arduino it’s going to be talking to. Since yours is an Uno, you’ll want to pick Tools > Board > Arduino Uno
.
Now we’ll tell the IDE how the Arduino is connected. From the top menu in your program, select Tools > Serial Port
and then select a port:
On Windows it’ll probably be COM3
or COM4
(or something else above COM2
). You don’t need to be 100% sure which one - we’ll be able to pick again if it doesn’t work!
On a Mac it should be something like /dev/tty.usbmodem
(there might be a few numbers after usbmodem
).
Missing tty.usbmodem
or a COM
port? Not using an Uno? You migh want to check the official documentation for Mac OS X or Windows.
Now we need to upload the sketch to the Arduino itself.
In the green area there’s a little button with a right-facing arrow on it. When you hover over it, you should see the word Upload appear. Click it!
Your board will blink ferociously for a moment, then (hopefully) a little light to the left will start blinking, one second on, one second off.
CONGRATULATIONS, YOU ARE A WORLD-CLASS CHAMPION AND YOUR ARDUINO WORKS.
If something goes wrong, try selecting a different Serial Port for your Arduino. If it still doesn’t work, it might be that your Arduino is broken! That just happens sometimes, especially with the cheaper ones.
Want your Arduino to stop blinking? Just unplug the USB cable. No need to warn it or turn it off or click an ‘Eject’ button or anything.
Now that we know how to plug in an Arduino and get it running, we’ll learn about breadboards and then tackle a real project!