CONTENTS

Preface

Acknowledgments

Introduction

1 This Is Arduino

Microcontrollers

Development Boards

A Tour of an Arduino Board

Power Supply

Power Connections

Analog Inputs

Digital Connections

Microcontroller

Other Components

The Origins of Arduino

The Arduino Family

Uno and Leonardo

Mega and Due

The Micro and Small Arduino Boards

Yun

Lilypad

Other “Official” Boards

Arduino Clones and Variants

Conclusion

2 Getting Started

Powering Up

Installing the Software

Uploading Your First Sketch

The Arduino Application

Conclusion

3 C Language Basics

Programming

What Is a Programming Language?

Blink—Again!

Variables

Experiments in C

Numeric Variables and Arithmetic

Commands

if

for

while

Constants

Conclusion

4 Functions

What Is a Function?

Parameters

Global, Local, and Static Variables

Return Values

Other Variable Types

floats

boolean

Other Data Types

Coding Style

Indentation

Opening Braces

Whitespace

Comments

Conclusion

5 Arrays and Strings

Arrays

Morse Code SOS Using Arrays

String Arrays

String Literals

String Variables

A Morse Code Translator

Data

Globals and Setup

The loop Function

The flashSequence Function

The flashDotOrDash Function

Putting It All Together

Conclusion

6 Input and Output

Digital Outputs

Digital Inputs

Pull-Up Resistors

Internal Pull-Up Resistors

Debouncing

Analog Outputs

Analog Input

Conclusion

7 The Standard Arduino Library

Random Numbers

Math Functions

Bit Manipulation

Advanced I/O

Generating Tones

Feeding Shift Registers

Interrupts

Conclusion

8 Data Storage

Constants

Storing Data in Flash Memory

EEPROM

Storing an int in EEPROM

Using the AVR EEPROM Library

Storing a float in EEPROM

Storing a String in EEPROM

Clearing the Contents of EEPROM

Compression

Range Compression

Conclusion

9 Displays

Alphanumeric LCD Displays

A USB Message Board

Using the Display

Other LCD Library Functions

OLED Graphic Displays

Connecting an OLED Display

Software

Conclusion

10 Arduino Internet of Things Programming

Communicating with Web Servers

HTTP

HTML

Arduino Uno as a Web Server

Web-Controlled Arduino

Node MCU Web Server

Web-Controlled Node MCU

Calling Web Services

Arduino Uno and IFTTT

Node MCU ESP8266 Board and IFTTT

Other IoT Options

Arduino Yun

Particle Photon

Conclusion

11 C++ and Libraries

Object Orientation

Classes and Methods

Built-In Library Example

Writing Libraries

The Header File

The Implementation File

Completing Your Library

Conclusion

Index