Skill Builder: Arduino 101

Arduino
Skill Builder: Arduino 101

arduioo-week

Ever heard of Arduino? It’s an awesome programmable microprocessor (mini computer) that you can make do almost anything!  Its main purpose is to make sensors react to actuators (lights, motors, and more). This primer will help you get started with Arduino and a little bit of coding.

The Arduino Leonardo is the main model of the Arduino, with just enough features for you to get started. It is also one of the most inexpensive and easy to use micro-controller platforms ($25).

ArduinoLeonardoFront_2_450px

All about open source

Arduino was built in Italy on open source hardware, a great inspiration for many products. Many companies and electronics products today are built on open source. To make a project open source, a person releases all of the design files to the public, so that the community can examine them, suggest changes and improvements, contribute and help make projects better!

Here are some cool projects that push the limits of the Arduino, that you can make too:

3D Printer (most 3D Printers are Arduino-compatible)

Quadcopters/Drones (an Arduino in air!)

Laser Harp (play tunes on lasers)

LED Cube

Chess playing robot

But first, we’re going to start very simple.  It all begins with blinking an LED!

What are all these parts, anyway?

First up—the board layout. Below is the Arduino Leonardo and all of its main components that you should know, and what they do.

Arduino Leonardo Diagram v2

Let’s talk the same language

Next up, we’re going to install the Arduino software on your computer. Go to bit.ly/arduinoide to download the Arduino IDE (computer software) for PC, Mac, or Linux. Follow the instructions on bit.ly/arduinopc if you are on a Windows machine, to install the last pieces of the software.

Now you’re ready to program! 

Arduino is written in a mixture of C and C++, an easy to use programming language. You might think that coding is all ones and zeros, but not with Arduino. The main idea that was thought up by the Arduino team was that the Arduino has to be accessible, or easy to use for anyone (kids, designers, artists, tinkerers, and makers). Thus, the Arduino code language is mostly in plain English, with some numbers here and there that are easy to understand. Let’s go over the simplest program for the Arduino!

This is the Blink sketch (sketch is another word for the program that runs on your Arduino). Open the Blink sketch by going to File > Examples > 01.Basics > Blink. The blink sketch turns an LED on for a second, and off for a second, making it blink.  You can use the built in LED at pin 13, labeled ‘L’, or plug in your own LED.

This example code is in the public domain, which means anyone has access to it.  Let’s examine the code!

/*

Blink

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

*/  Explaining what the code will do.  Anything within /* */ or after // is ignored, and is a comment to yourself on what the piece of code will do (a great reminder after creating tens or hundreds of sketches).

int led = 13;   The format:  int (an integer/number) led (name) = 13 (pin where LED is connected to) ; (semicolons are needed after every line that you type out code, except for setup(), loop(), and any other function (anything with () ).

void setup() {    Void setup: code that runs once; setup your inputs and outputs.

pinMode(led, OUTPUT);   setup our output

}

void loop() {   Void loop: runs over and over after setup

digitalWrite(led, HIGH);   turn the LED on (HIGH is “on” in the Arduino language)

delay(1000);               delay/wait for a second (1000 milliseconds = 1 second)

digitalWrite(led, LOW);    turn the LED off (LOW is “off” in the Arduino language)

delay(1000);               delay/wait for a second

}

It is now time to upload the sketch to our Arduino board!  Click on Tools > Board > Arduino Leonardo (if you are using an Arduino Leonardo), and click on Tools > Board > Port, and select the one using /dev/tty.usbmodemfd121 (somewhat along those lines) if you are using a Mac, and select the lowest COM Port if you are on a PC.  Then, press the Compile + Upload button pictured below (the right arrow). This will verify that there are no errors in the code, and then upload it to the Arduino board. If there were errors, these would show as a message in the black rectangle below the code.

Arduino Code 1

After about 5 seconds, the LEDs should blink very fast on the board, and then after that LED ‘L’ should be blinking one second on, and one second off. You have made your first project!

Branching out, you can definitely do many more projects with the knowledge that you have right now! For example, you could have ten LEDs blink, or have a display of multicolored LEDs!  For more ideas and tutorials on Arduino projects, visit bit.ly/makearduino.

This post originally appeared on Dec 4 2013, and was republished on Jan 6 2014.

6 thoughts on “Skill Builder: Arduino 101

  1. SaluteSkill Builder: Arduino 101 | Salute says:

    […] Read more on MAKE […]

  2. Skill Builder: Arduino 101 | R2D2's blog says:

    […] Read more on MAKE […]

  3. Skill Builder: meet the Arduino 101- a programmable microprocessor (mini computer) | BONNIE SANDY IN DeMarketplace says:

    […] See on makezine.com […]

  4. Skill Builder: Arduino 101 | InKleined-To-Teach says:

    […] Source: makezine.com […]

  5. Skill Builder: Arduino 101 - DevOps Infographics Resource Center says:

    […] The source of this magnificent infographic from makezine.com […]

  6. Skill Builder: Arduino 101 - DevOps Infographics Resource Center says:

    […] The source of this awesome design from makezine.com […]

Comments are closed.

Discuss this article with the rest of the community on our Discord server!
Tagged

Quin Etnyre is the 13 year old CEO of Qtechknow, a developer and supplier of Arduino-related kits, ArduSensors, that help people learn through making. He has recently been a speaker at Maker Faire SLO, Bay Area, Rome, and featured in Popular Science, and on the BBC.

View more articles by Quin Etnyre

ADVERTISEMENT

Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).

FEEDBACK