Skip to Content
Environmental Monitoring with Arduino
book

Environmental Monitoring with Arduino

by Emily Gertz, Patrick Di Justo
January 2012
Beginner
98 pages
1h 49m
English
O'Reilly Media, Inc.
Content preview from Environmental Monitoring with Arduino

First Sketch: Make an LED Blink

By long tradition (going back to 2006), the first Arduino sketch you write is to make an LED blink.

Arduino pins can be used for input and output, as long as you tell the computer which is which. So in this sketch, we tell the Arduino to set pin 13 to be the LED OUTPUT pin, and then we alternately send electricity to pin 13 (setting the pin HIGH) and cut off the electricity to pin 13 (setting the pin LOW). With each alternation, the LED turns on and off.

We’ll write all the sketches in this book using the Arduino “integrated development environment” (IDE), which, simply put, is special software for writing and uploading code to Arduino.

Parts

  1. Arduino Uno
  2. Breadboard
  3. LED

Install the IDE

Download the Arduino IDE from http://arduino.cc/en/Main/Software, and follow the provided instructions to install it on your computer.

Once you’ve installed the software, open the IDE. You should see a screen that looks something like Figure 1-3.

The Arduino IDE on a Mac.

Figure 1-3. The Arduino IDE on a Mac.

Breadboard the Circuit

The circuit portion of this project is very simple:

Take an LED and place the long lead into pin 13 on Arduino, as you can see in the Figure 1-4 breadboard view.

LED long lead inserted into pin 13 on the Arduino (image made with Fritzing.org).

Figure 1-4. LED long lead inserted into pin 13 on the Arduino (image made with Fritzing.org).

Write the Code

You can ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Atmospheric Monitoring with Arduino

Atmospheric Monitoring with Arduino

Patrick Di Justo, Emily Gertz
Make a Mind-Controlled Arduino Robot

Make a Mind-Controlled Arduino Robot

Tero Karvinen, Kimmo Karvinen

Publisher Resources

ISBN: 9781449328603Catalog PageErrata