Table of Contents
Acknowledgements vii
About the Authors viii
Preface ix
1 Introduction to Arduino 1
Physical Computing 3
Prototyping 3
What Will I Need and Where Can I Get It? 4
Parts and Tools 5
Resources 12
Summary 13
2 Your Arduino 15
Parts of an Arduino 16
Plug Your Arduino into Your Computer 20
Components and Tools 26
Summary 30
3 Meet the Circuit 31
The Circuit: Building Block of Electronics 32
The Schematic 37
Using a Breadboard 42
Building a Circuit 48
A Look at the Battery 52
Power for Our Circuit: Electricity 55
Debugging the Circuit 57
The Multimeter 60
Using the Multimeter 65
Back to Debugging Our Circuit 69
Summary 71
4 Programming the Arduino 73
Arduino, Circuits, and Code: Bringing Everything Together 74
What's an IDE? 75
Downloading the Arduino IDE: Getting Started 78
The Sketch: The Basic Unit of Arduino Programming 90
Debugging: What to Do if the LED Isn't Blinking 96
LEA4_Blink Sketch: An Overview 98
Setup() and loop(): The Guts of Your Code 101
Looking at loop(): What Happens Over and Over 109
A Schematic of the Arduino 115
Building the Basic Circuit 118
SOS Signal Light: Creating More Complex Timing 125
Summary 135
5 Electricity and Metering 137
Understanding Electricity 138
Build the Circuit Step by Step 140
Electricity: An Overview 144
Understanding Electricity: The Water Tank Analogy 148
Voltage: The Potential 149
Current: The Flow 159
Resistance: Restricting the Flow 167
Voltage, Current, Resistance: Review 173
How Do Voltage, Current, and Resistance Interact? Ohm's Law 177
Components in Parallel and Series 180
Summary 192
6 Switches, LEDs, and More 193
Interactivity! 194
Digital inputs and Outputs Overview 195
Digital Input: Add a Button 197
Looking at the Sketch: Variables 206
Digital Input Refresher 213
Looking at the Sketch: Conditional Statements 215
Add a Speaker and Adjust the Code 220
Add Two More Buttons and Adjust the Code 227
Reviewing Electronic and Code Concepts 236
Summary 239
7 Analog Values 241
There's More to Life than On and Off! 241
Potentiometer Circuit, Step by Step 246
The LEA7_AnalogInOutSerial Sketch 254
Analog Input: Values from the Potentiometer 259
Analog Values as Output: PWM 266
Serial Communication 269
Adding the Speaker 278
Adding the Photoresistor 282
Summary 288
8 Servo Motors 289
Waving the Flags 291
Servos Up Close 292
Building the Servo Circuit Step by Step 295
LEA8_Sweep Overview 301
What's a for Loop? 304
Operators 309
The for Loop in the Sketch 312
Add Interactivity: Turn the Flag 314
LEA8_Knob Explained 317
Two Flags Waving: Add a Second Servo Motor 320
LEA8_2_servos, First Look 322
Summary 332
9 Building Your Projects 333
Project Management 334
A Few Helpful Components 338
Types of Projects 342
Other Versions of the Arduino Board 345
Document Your Project and Share It! 348
Summary 350
A Appendix: Redding Resistor Codes 351
Identifying Resistors by Color Bands 351