Programming Arduino: Getting Started with Sketches, Second Edition

Programming Arduino: Getting Started with Sketches, Second Edition

by Simon Monk

NOOK Book(eBook)

$9.04 $15.00 Save 40% Current price is $9.04, Original price is $15. You Save 40%.
View All Available Formats & Editions

Available on Compatible NOOK Devices and the free NOOK Apps.
WANT A NOOK?  Explore Now

Overview

A fully updated guide to quickly and easily programming Arduino

Thoroughly revised for the new Arduino Uno R3, this bestselling guide explains how to write well-crafted sketches using Arduino’s modified C language. You will learn how to configure hardware and software, develop your own sketches, work with built-in and custom Arduino libraries, and explore the Internet of Things—all with no prior programming experience required!

Electronics guru Simon Monk gets you up to speed quickly, teaching all concepts and syntax through simple language and clear instruction designed for absolute beginners. Programming Arduino: Getting Started with Sketches, Second Edition, features dozens of easy-to-follow examples and high-quality illustrations. All of the sample sketches featured in the book can be used as-is or modified to suit your needs.

  • An all-new chapter teaches programming Arduino for Internet of Things projects
  • Screenshots, diagrams, and source code illustrate each technique
  • All sample programs in the book are available for download

Product Details

ISBN-13: 9781259641640
Publisher: McGraw-Hill Education
Publication date: 06/29/2016
Sold by: Barnes & Noble
Format: NOOK Book
Pages: 208
Sales rank: 220,051
File size: 17 MB
Note: This product may take a few minutes to download.

About the Author

Simon Monk has a degree in cybernetics and computer science and a Ph.D. in software engineering. He is the author of numerous books, including Programming the Raspberry Pi: Getting Started Python, 30 Arduino Projects for the Evil Genius, Hacking Electronics, and Fritzing for Inventors. Simon also runs the website monkmakes.com, which features his own products.

Table of Contents

Preface ix

Acknowledgments xi

Introduction xiii

1 This Is Arduino 1

Microcontrollers 1

Development Boards 2

A Tour of an Arduino Board 3

Power Supply 4

Power Connections 4

Analog Inputs 4

Digital Connections 5

Microcontroller 5

Other Components 6

The Origins of Arduino 6

The Arduino Family 8

Uno and Leonardo 8

Mega and Due 9

The Micro and Small Arduino Boards 10

Yun 10

Lilypad 11

Other "Official" Boards 11

Arduino Clones and Variants 12

Conclusion 13

2 Getting Started 15

Powering Up 15

Installing the Software 16

Uploading Your First Sketch 17

The Arduino Application 22

Conclusion 25

3 C Language Basics 27

Programming 27

What Is a Programming Language? 29

Blink-Again! 34

Variables 36

Experiments in C 37

Numeric Variables and Arithmetic 39

Commands 41

If 41

For 43

While 46

Constants 47

Conclusion 47

4 Functions 49

What Is a Function? 49

Parameters 50

Global, Local, and Static Variables 52

Return Values 55

Other Variable Types 56

Floats 56

Boolean 57

Other Data Types 58

Coding Style 59

Indentation 59

Opening Braces 60

Whitespace 60

Comments 61

Conclusion 62

5 Arrays and Strings 63

Arrays 63

Morse Code SOS Using Arrays 66

String Arrays 67

String Literals 67

String Variables 69

A Morse Code Translator 69

Data 70

Globals and Setup 71

The loop Function 72

The flashSequence Function 75

The flashDotOrDash Function 75

Putting It All Together 76

Conclusion 78

6 Input and Output 79

Digital Outputs 79

Digital Inputs 83

Pull-Up Resistors 83

Internal Pull-Up Resistors 86

Debouncing 87

Analog Outputs 92

Analog Input 94

Conclusion 96

7 The Standard Arduino Library 97

Random Numbers 97

Math Functions 100

Bit Manipulation 100

Advanced I/O 102

Generating Tones 102

Feeding Shift Registers 104

Interrupts 104

Conclusion 106

8 Data Storage 107

Constants 107

Storing Data in Flash Memory 108

EEPROM 110

Storing an int in EEPROM 111

Using the AVR EEPROM Library 112

Storing a float in EEPROM 113

Storing a String in EEPROM 113

Clearing the Contents of EEPROM 115

Compression 116

Range Compression 116

Conclusion 117

9 Displays 119

Alphanumeric LCD Displays 120

A USB Message Board 121

Using the Display 123

Other LCD Library Functions 124

OLED Graphic Displays 124

Connecting an OLED Display 125

Software 126

Conclusion 128

10 Arduino Internet of Things Programming 129

Communicating with Web Servers 130

HTTP 130

HTML 131

Arduino Uno as a Web Server 132

Web-Controlled Arduino 135

Node MCU Web Server 140

Web-Controlled Node MCU 145

Calling Web Services 148

Arduino Uno and IFTTT 151

Node MCU ESP8266 Board and IFTTT 153

Other loT Options 155

Arduino Yun 155

Particle Photon 156

Conclusion 156

11 C+ + and Libraries 157

Object Orientation 157

Classes and Methods 157

Built-in Library Example 158

Writing Libraries 158

The Header File 159

The Implementation File 160

Completing Your Library 161

Conclusion 164

Index 167

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews