Programming Arduino: Getting Started with Sketches, Third Edition

Programming Arduino: Getting Started with Sketches, Third Edition

by Simon Monk
Programming Arduino: Getting Started with Sketches, Third Edition

Programming Arduino: Getting Started with Sketches, Third Edition

by Simon Monk

Paperback(3rd ed.)

    Qualifies for Free Shipping
    Choose Expedited Shipping at checkout for delivery by Wednesday, February 28
    Check Availability at Nearby Stores

Related collections and offers


An up-to-date Arduino programming guide—no prior programming experience required!

This fully updated guide shows, step by step, how to quickly and easily program all Arduino models using its modified C language and the Arduino IDE. Electronics guru Simon Monk gets you up to speed quickly, teaching all concepts through simple language and clear instruction. Programming Arduino®: Getting Started with Sketches, Third 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. You will also get all new coverage of using Arduino as a framework for programming other popular boards.

  • Configure your Arduino and start writing sketches
  • Understand the basics of C language and the Arduino IDE
  • Add functions, arrays, and strings to your sketches
  • Set up Arduino’s digital and analog I/O
  • Use Arduino-compatible boards including ESP32, Pico, and micro:bit
  • Work with built-in and custom Arduino libraries
  • Write sketches that store data in EPROM or flash memory
  • Interface with a wide range of displays, including LCDs
  • Connect to the Internet and configure Arduino as a web server
  • Develop interesting and useful programs for the Internet of Things

Product Details

ISBN-13: 9781264676989
Publisher: McGraw Hill LLC
Publication date: 12/13/2022
Edition description: 3rd ed.
Pages: 176
Sales rank: 665,353
Product dimensions: 5.90(w) x 8.90(h) x 0.10(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 Arduino, 30 Arduino Projects for the Evil Genius; Hacking Electronics; and Make Your Own PCBs with Fritzing.

Table of Contents

Preface xi

Acknowledgments xiii

Introduction xv

1 Getting Started 1

Microcontrollers 1

Development Boards 2

A Tour of an Arduino Uno Board 3

Power Supply 4

Power Connections 4

Analog Inputs 4

Digital Connections 4

Microcontroller 5

Other Components 5

A Tour of a WiFi-Capable Arduino-Compatible 6

The Origins of Arduino 7

Powering Up 8

Installing the Software 8

Uploading Your First Sketch 10

The Arduino Application 14

Conclusion 16

2 C Language Basics 17

Programming 17

What Is a Programming Language? 19

Blink-Again! 24

Variables 26

Experiments in C 27

Numeric Variables and Arithmetic 29

Commands 31

If 31

For 33

While 36

Constants 37

Conclusion 37

3 Functions 39

What Is a Function? 39

Parameters 40

Global, Local, and Static Variables 41

Return Values 44

Other Variable Types 45

Floats 45

Boolean 46

Other Data Types 47

Coding Style 49

Indentation 49

Opening Braces 50

Whitespace 50

Comments 51

Conclusion 52

4 Arrays and Strings 53

Arrays 53

Morse Code SOS Using Arrays 56

String Arrays 57

String Literals 57

String Variables 59

A Morse Code Translator 59

Data 60

Globals and Setup 61

The loop Function 62

The flashSequence Function 64

The flashDotOrDash Function 65

Putting It All Together 66

The String Class 67

Conclusion 67

5 Input and Output 69

Digital Outputs 69

5 V or 3.3 V? 72

Digital Inputs 73

Pull-Up Resistors 73

Internal Pull-Up Resistors 76

Debouncing 77

Analog Outputs 82

Analog Input 84

Conclusion 86

6 Boards 87

Arduino Nano 87

Arduino Pro Mini 89

Breadboard 90

The Boards Manager 91

ESP32 Boards 92

Raspberry Pi Pico 95

BBC micro:bit 96

Adafruit Feather System 98

Conclusion 99

7 Advanced Arduino 101

Random Numbers 101

Math Functions 104

Bit Manipulation 104

Advanced I/O 106

Generating Tones 106

Feeding Shift Registers 108

Interrupts 108

Compile-Time Constants 110

The Arduino Web Editor 111

Conclusion 112

8 Data Storage 113

Large Data Structures 113

Storing Data in Flash Memory 114


Storing an int in EEPROM 117

Writing Anything to EEPROM 119

Storing a float in EEPROM 120

Storing a String in EEPROM 121

Clearing the Contents of EEPROM 122

Compression 123

Range Compression 123

Conclusion 124

9 Displays 125

Alphanumeric LCD Displays 126

A USB Message Board 127

Using the Display 129

Other LCD Library Functions 130

OLED Graphic Displays 130

Connecting an OLED Display 131

Software 132

Conclusion 134

10 Arduino Internet of Things Programming 135

Boards for IoT 135

Installing ESP32 into the Arduino IDE 136

Connecting to WiFi 137

Running a Web Server 139

Serving Sensor Readings 141

Serving Sensor Readings-Improved 142

Turning the Built-in LED On and Off from a Web Page 146

Connecting to a Web Service 147

Conclusion 153

Index 155

From the B&N Reads Blog

Customer Reviews