Programming Arduino: Getting Started with Sketches, Second Edition

Programming Arduino: Getting Started with Sketches, Second Edition

by Simon Monk

Paperback

$13.50 $15.00 Save 10% Current price is $13.5, Original price is $15. You Save 10%.
View All Available Formats & Editions
Choose Expedited Shipping at checkout for guaranteed delivery by Wednesday, August 28

Overview

Publisher's Note: Products purchased from Third Party sellers are not guaranteed by the publisher for quality, authenticity, or access to any online entitlements included with the product.


Program Arduino with ease!

This thoroughly updated guide shows, step-by-step, how to quickly program all Arduino models. Programming Arduino: Getting Started with Sketches, Second Edition, features easy-to-follow explanations, fun examples, and downloadable sample programs. Discover how to write basic sketches, use Arduino’s modified C language, store data, and interface with the Web. You will also get hands-on coverage of C++, library writing, and programming Arduino for the Internet of Things. No prior programming experience is required!

• Understand Arduino hardware fundamentals
• Set up the software, power up your Arduino, and start uploading sketches
• Learn C language basics
• Add functions, arrays, and strings to your sketches
• Program Arduino’s digital and analog inputs and outputs
• Use functions from the standard Arduino library
• Write sketches that can store data
• Interface with displays, including OLEDs and LCDs
• Connect to the Internet and configure Arduino as a Web server
• Develop interesting programs for the Internet of Things
• Write your own Arduino libraries and use object-oriented programming methods

Product Details

ISBN-13: 9781259641633
Publisher: McGraw-Hill Professional Publishing
Publication date: 06/09/2016
Pages: 192
Sales rank: 330,690
Product dimensions: 5.90(w) x 8.90(h) x 0.50(d)

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