First, you need to get your real Arduino and the free Arduino Software installed and working. Then come back here and we'll try out a few fun things...

You should always get the latest Arduino Software from the Arduino website.

Now, click on link to the following Arduino Website page that is right for your computer and operating system:

Then come Blinkin' Back Here!

---------( A little while Later )-------------

OK, so you've got your Arduino plugged in and running. The green (power) "ON" LED is on, right? And the "L" LED is blinking? (May be a little different for the various Arduino clones). Here's a detailed look at the Arduino UNO:

Over on the right, the ON LED should be lit (usually Green). And over on the left, the "L" LED should be blinking (usually Yellow). (Unless you already downloaded some other software SKETCH to your Arduino.)

Most Arduinos have an LED and a resistor permanently connected from Pin 13 to GND. They are inside the circle above. More details in a minute.


Let's take a little while to get used to writing Arduino Software, then we'll come back and start adding HARDWARE and making more interesting things.

You should have found and downloaded and installed the Arduino software, plugged your Arduino into USB, and set the right BOARD type and SERIAL PORT. If not, jump back to the top of this page and do that...

OK, on your desktop you should now have the Arduino ICON like this:

Click on it, if you haven't already, and you should see the "Arduino IDE Window" pop up like this:

This is the INTEGRATED DEVELOPMENT ENVIRONMENT where you can make Software VISIBLE! Here you will develop your own software to make Arduino into what you want it to be.


The visible text of an Arduino software program is called a SKETCH. But the Sketch becomes alive when you upload it to your Arduino. Let's walk through looking at a Sketch and Verifying it and Uploading it:

Click on FILE and then move your mouse over EXAMPLES and BASICS and BLINK

so it looks like this:

And CLICK. There are lots of examples that come with the free Arduino software system, and we will look at some of them later, as well as make our own very soon.
A new IDE window should pop up and look like this:

Wow.. A bunch of new stuff.

Let's slow down and "Watch Closely Now"!

Notice that a lot of the text is GREY. All of that is just "Comments" for you to read to help understand the Sketch. When you write software, you should also use "Comments" to explain to others what you are doing. (Arduino itself does not see anything about these comments).

Now, let's go through changing software, Verifying it, and Uploading it to see Arduino DO it. We'll use the BLINK example for now, but soon you'll start with a totally blank page and write your own programs.

Every Arduino Program has the same basic structure:

You will read a LOT of program "Code" that other people wrote, in the future. You HAVE to "Watch Closely Now" and really see the details. Read the example through carefully, a couple of times. Note the colored special words that are INSTRUCTIONS.

INSTRUCTIONS: Are unique words that tell Arduino what to do.

What SETUP does: Instructs Arduino about things that need to be done once. Remember that Arduino Digital Pins can be either INPUT or OUTPUT. You have to tell Arduino when a Pin will be used as an OUTPUT. In this example, there is one line that tells Arduino that Pin 13 must be an OUTPUT.

Note the COLOR of the lettering. The Arduino IDE changes the color of words as it recognizes them as special instructions. Let's mess with them:

pinMode: Note that when Instructions are two words run together, like pinMode, the beginning of the SECOND word is Capitalized. Mess with it: Change the Capital "M" to "m". Note the color changes to black. Hmmm. Click the VERIFY Button:

You will get an ERROR message:

Fussy, Fussy, Fussy! Yep, every letter has to be recognized.

Change it back. Check the color. Click Verify again. OK??

What does VERIFY do??

A lot! More details later, but Verify is a program in your main computer that goes through every Instruction in your Sketch (Ignoring "Comments") and checks it against the list of valid Instructions, and checks that the structure and sequence of the statements in the Sketch are correct. Fussy, Fussy! If that's OK, then it "compiles" or "translates" the sketch into the actual machine code that Arduino actually runs on. It saves that 'ready-to-run' code for you to Upload to Arduino and run.

What does UPLOAD do??

First, Upload runs Verify to check and compile your program. Then it communicates to your Arduino over the USB connection, resets the Arduino chip, and talks to software already on Arduino (called the BOOTLOADER) to load your new program into the Arduino's memory. Then it restarts Arduino and your program runs it's SETUP section and then repeats the LOOP section.

Start Making Changes:

Ok, let's make a few changes to the sample BLINK program:

The LOOP section of your program does all the instructions in the section, and then "loops" back to the top and starts it again, over and over.

NOTE: the "Brackets" { and }

Notice that the beginning and end of the section is "inside brackets". You will see many sections of bigger programs that are grouped by these "brackets".

Now, let's look in detail at the instructions:


This instruction sets an OUTPUT PIN to either HIGH (connects it to +5 V) or LOW (Connects it to GND). Remember: HIGH = 1 = ON = 5V

So, the first line in LOOP sets PIN 13 to HIGH. There is an LED and resistor already connected to PIN 13, so the LED lights up.


The delay instruction just waits for a period of time. The VALUE used with delay is in Milliseconds (1/1000 second). So delay(1000); waits for 1000/1000 seconds (1 second). We'll change that soon.

NOTE: the ";"

Notice that every instruction is followed by the character " ; " which is like a period that tells the end of the sentence.

Change the delay so that the LED blinks differently:

Time to mess about and try some things!

Suggestion: Save your own version of BLINK so you can always go back to the original one. Go to File and Save As and call it something like MyBlink. This will go in your SKETCHBOOK where you'll save your own programs.

Now go change the VALUE in a delay statement to change the way the LED blinks. Think about the the 4 instructions in LOOP. What's happening??

So, let's change the ON time to be very short. Maybe 50 Milliseconds.

Each time you make a change, click upload which will first Verify and Compile your program and then send it to Arduino. Notice that each time you do this the LEDS flash that are marked "Tx" (Transmit) and "Rx" (receive) as your main computer communicates to the Arduino.

Try some combinations of ON and OFF times. Like ON 1000 and OFF 50.

Try making both ON and OFF times shorter and shorter. If you make the ON and OFF times short enough your eye will no longer see blinking, because of "Persistence of Vision" which happens when there are more than about 25 blinks per second. So, hmmm.... if you make the LED be ON for 1/50 of a second and OFF for 1/50 of a second that should do it. So try 1000/50= 20 Milliseconds. Put 20 for both the ON and OFF times. What do you see?? How about 10 Milliseconds each?

Pulse Width Modulation:

This idea of turning an OUTPUT on and off rapidly can be used to dim lights, control motor speeds and so forth, even though a DIGITAL OUTPUT can only be a 0 (OFF, or LOW) or 1 (ON, or HIGH). Look closely at your Arduino. Some of the digital outputs have a small wave symbol ~ next to them, or the letters PWM. Later you will see how Arduino can use these for dimming, speed control and more.


Or maybe time for a break?? Next we will start connecting more interesting things and make Arduino do more work.

There are two different ways to start "hooking stuff up to Arduino" .. BREADBOARDS and ELECTRONIC BRICKS. We will look quickly at both of these, and then do more detail with each approach.

NEXT: Electronic Bricks (CLICK)

COMMENTS? SUGGESTIONS! Please Email Terry King, Webmaster ©2010 Terry King