Numbers
3.3V port, 142
5V power and GND
versus 3.3V port, 142
attaching to breadboard, 121, 125
8 ohm speaker
circuit, 32
digitalWrite()
function, 226–227
illustration, 8
note chart, 225
playing notes, 239
9V battery. See also batteries
attaching cap, 53
ground terminal, 52
illustration, 5
multimeter, 62
plus (+) and minus (-) terminals, 52
power terminal, 52
top and side, 53
9-volt battery cap or holder, 5–6
10K potentiometer, 5
330-ohm resistor, 48–49, 58. See also resistors
Symbols
-- operator, 312
//, using with comments, 100–101
/* and */, using with comments, 100–101
/= operator, 312
++ operator, 312
+= operator, 312
−= operator, 312
*= operator, 312
{}
(curly braces)
for
loop, 305
using, 115
using with setup()
, 104
> (greater than) operator, 310
>= (greater than or equal to) operator, 310
= = (is equal to) operator, 310
!= (is not equal to) operator, 310, 324–325
< (less than) operator, 310
<= (less than or equal to) operator, 310
&& (logical and) operator, 329
|| (logical or) operator, 329
− (minus) sign, 43
! (not) operator, 329
()
(parentheses) in functions, 226, 305
+ (plus) sign, 44
;
(semicolon) in code, 105–106
(tab), 277
A
AC adapter, output ratings, 162
addition operators, 311
amperage
warning, 166
analog input
analogWrite()
function, 264–265
scaling values for ranges, 263
voltage-to-analog conversion, 262
analog input pins
analog values. See also PWM (pulse width modulation)
potentiometer, 245
potentiometer circuit, 243
analog versus digital information, 242
analogRead()
function, 265
analog-to-digital conversion, 260
analogWrite()
function, 264–265, 268
anode and cathode
illustration, 9
Arduino. See also Uno version
app, 79
flowchart, 76
forums, 336
functions and boards, 2
hardware version, 85
license agreement, 81
logo, 1
parts, 16
programming language, 99
setup()
and loop()
, 99
shields, 348
unplugging during changes, 23
Arduino IDE. See IDE (integrated development environment)
Arduino team, kits, 13
Arduino YÚN, 346
arguments, 226–227. See also functions
art projects, 344
B
batteries. See also 9V battery
current, 147
positive and negative sides, 55
voltage, current, resistance, 176
begin()
function, LEA7_AnalogInOutSerial sketch, 258
Blink sketch. See also LEA4_Blink sketch
blinking LEDs. See LEDs
Boolean operators, 329–331. See also operators
breadboard
5V power and GND, 121
benefits, 47
circuits attached, 74
connecting components, 7
labeling, 119
pins, 120
power and ground connection, 57
power and ground pins, 120
trench, 46
warning, 44
“x-ray” view, 44
brightness value, translating, 251–254
built-in LEDs, Uno version, 18
button circuit, building, 200. See also circuits
button keyboard, three-tone, 194
Button sketch, uploading, 204–205
buttons. See also digital input; three-button “Instrument” loop()
function; two-button circuit
adding to breadboard, 202
adding to pin, 204
ground connection, 203
identifying, 90
LED circuit, 198
power connection, 203
pushing, 238
resistor connection, 203
uploading sketch, 204
C
calling functions, 106
cardboard robot circuit, 32
cathode and anode, 9
Christmas lights, series arrangement, 190
circuit loops, debugging, 58–59
circuits. See also button circuit; electricity; potentiometer circuit; short circuit
3.3V, 142
Arduino connected to breadboard, 119–121
attached to breadboard, 74
building, 49–52, 121–122, 140–142
component arrangement, 180
conductive lines, 34
continuity testing, 69–70, 144
examples, 32
features, 34
flow, 33
Ohm’s law, 178
PCBs (printed circuit boards), 34–35
pin connected to resistor, 121–122
power and ground pins, 141–142
tracks, 33
voltage measurement, 157
code. See also comments
in circuit, 74
instructions, 105
uploading, 75
comments. See also code
LEA4_Blink sketch, 99
components. See also parts
arranging in circuits, 180
getting information, 26
pressing into place, 49
schematic symbols, 40
components in parallel. See parallel
components in series. See series
computer, connecting Arduino, 82–83
conditional statements
best practices, 331
if
, 217
LEA6_Button sketch, 215
nesting, 220
reviewing, 237
conductors and insulators, 145–146
const
, variables, 212
continuity testing, 58–59, 65–70, 144
curly braces ({})
for
loop, 305
using, 115
using with setup()
, 104
current. See also high current; Ohm’s law
electrical model, 161
impact on batteries, 176
impact on LEDs, 176
impact on resistors, 176
input, 163
multimeter adjustment, 164–167
series and parallel, 192
voltage and resistance, 148–149, 167, 173–180
custom functions. See also functions
using, 331
D
DC current, symbol, 159
DC motors, 340
DC voltage
measuring, 154
symbols, 175
debugging
explained, 96
delay()
function, 111–112, 114, 226–227
Digi-Key Electronics, 12
digital input. See also buttons
button attachment, 204
button circuit, 200
button connection, 203
HIGH
and LOW
states, 213–214, 241
digital inputs and outputs, overview, 195–197
digital pins, treating like output, 107
digital versus analog information, 242
digitalRead()
function, 265
digitalWrite()
function, 110–112, 115, 226–227, 265
distance and motion, sensing, 338
division operator, 311
E
electrical connection, testing, 65–66
electrical ground, 152
electrical model
current, 161
resistors, 169
electrical properties
series and parallel, 192
symbols, 174
electrical properties, testing, 139–140
electricity. See also circuits
conductive lines, 36
flow, 150
flow through circuit, 138, 251–254
measuring with multimeter, 139–140
properties, 138
resources, 148
water tank analogy, 148–149, 174
zero point, 152
electromotive force, 150
else if
statement, 220, 230–232
end = ground symbol, 39
errors, checking in code, 77, 88–89
F
flags
waving, 291–292, 300–301, 320–322, 331
flow
flowchart, 76
for
loop. See alsoloop()
function
ending, 308
flowchart, 306
flowchart with code, 309
initialization, 307
FSRs (force-sensing resistors), 339
functions. See also arguments; custom functions
calling, 106
declaring, 326
naming, 327
void
, 327
G
GND and 5V power, attaching to breadboard, 121. See also power and ground pins
greater than (>) operator, 310
greater than or equal to (>=) operator, 310
ground terminal, 56
H
hardware
open source, 3
version, 85
HIGH
and LOW
states, digital input, 213–214, 241
high current, 167. See also current
home automation projects, 343
I
IDE (integrated development environment)
Applications
folder, 79
closing sketch windows, 84
components, 77
contents, 76
errors and information window, 89
explained, 75
message areas, 89
if
in conditional statements, 217
indicator LED, On Uno version, 18
input and output pins, 16, 18–19. See digital I/O
inputs and outputs, 324
instructions in code, 105
insulators and conductors, 145–146
interactivity
three-tone button keyboard, 194–195
is equal to (= =) operator, 310
is not equal to (!=) operator, 310, 324–325
J
Jameco Electronics, 12
jumper to ground, LED bulb flashlight, 51
jumper wires
creating, 10
illustration, 8
LED bulb flashlight, 48
LED to ground, 123
pin to breadboard, 121
K
kits, 13
L
LEA4_Blink sketch. See also Blink sketch
button circuit, 200
code, 99
saving, 92
schematic for circuit, 117
LEA4_SOS sketch. See also SOS signal light
and circuit, 126
downloading, 135
loop()
code, 128
LEA6_1_tonebutton sketch, 221
LEA6_2_tonebuttons sketch
LEA6_3_tonebuttons sketch, 234–236
LEA6_Button sketch
conditional statement, 216–220
saving, 204
variable initialization, 207–208
LEA7_AnalogInOutSerial sketch
analogInPin
, 255
analogOutPin
, 256
begin()
function, 258
code, 254
outputValue
, 257
saving, 250
sensorValue
, 256
LEA7_VariableResistorTone
LEA8_2_servos sketch
code, 322
initialization, 323
LEA8_Knob sketch. See also servo motors
code, 316
saving, 315
setup()
code, 318
LEA8_Sweep sketch
library, 302
loop()
code, 304
objects, 303
opening and saving, 300
overview, 301
LED bulb flashlight
battery cap, 52
debugging circuit, 57–60, 69–70
jumper to ground, 51
LED circuit, buttons, 198
LEDs
adding to circuit, 122
debugging unblinking, 96–98, 124
dimming and brightening, 250
illustration, 7
On indicator, 16
LED bulb flashlight, 48, 50–51
orientation, 58
positive and negative leads, 58
turning on, 22
voltage, current, resistance, 176
Leonardo board, 347
less than (<) operator, 310
less than or equal to (<=) operator, 310
libraries, defined, 302
light switches, flipping, 266
logical and (&&) operator, 329
logical comparison operators, 310
logical or (||) operator, 329
loop()
function, 99, 109–115. See alsofor
loop; setup()
function
conditional statements, 215–216
contents, 110
digitalWrite()
and delay()
, 111–112
LEA4_Blink sketch, 99
LEA4_SOS sketch, 128
mini-keyboard instrument, 230–232
running, 110
loops, types, 313
M
Macs
port selection, 86
menus, 77
metal, warning about touching, 154
meter. See multimeter
Micro board, 347
Micro Center, 12
mini-keyboard instrument
button attachment, 229
parts, 228
playing, 236
pushing buttons, 232
testing code, 232
tone()
function, 232
two-button circuit, 228
mini-keyboard instrument, playing, 238
minus (−) sign, 43
MKR ZERO board, 347
momentary switches/buttons, 5, 7
Morse code, 125
motion and distance, sensing, 338
motor circuit, 32
motors and actuators, 340–342. See also servo motors
Mouser Electronics, 12
multimeter
features, 60
high current, 167
illustration, 9
measuring electrical properties, 139–140
powering, 62
preserving battery, 156
protecting, 166
setting, 166
turning off, 62
types, 61
warning, 166
multiplication operator, 311
N
New button, 90
not (!) operator, 329
note chart, 225
notes, playing, 239
O
objects, explained, 303
ohms, symbol, 168
Ohm’s law, 138, 177–180. See also current; resistance; voltage
Open button, 90
open source hardware, 3
operators, 309–311. See also Boolean operators
output, treating pins as, 107, 109
outputs, 197
P
parallel
order of components, 180
parentheses (()
) in functions, 226, 305
parts. See also components; tools
Arduino, 16
numbers and store guides, 27
obtaining, 12
placing in box, 27
parts list, 5
pausing Arduino, 111–112, 114, 226–227
PCBs (printed circuit boards), 34–35
photographing projects, 348–349
photoresistor
circuit, 32
features, 7
illustration, 8
and resistor, 284
shining light, 286
physical computing, 3
pin and resistor, connecting, 121–122
pinMode()
function, calling, 106–109
pins
declaring, 109
treating like output, 107
using on breadboard, 120
PIRs (passive infrared sensors), 338
planning notes, 335
pliers, needle-nose, 10
plus (+) and minus (-) terminals, 9V battery, 52
plus (+) sign, 44
potential and voltage, 149–153
potentiometer
analog-to-digital conversion, 260
component drawing, 245
dimming lights, 250
illustration, 7
pins, 248
schematic, 245
x-ray, 285
potentiometer circuit. See also circuits
building, 247
completion, 246
parts, 247
schematic, 243
power
battery, 56
terminology, 55
power adapter, 7
power and ground
checking connections, 57
symbols, 40
power and ground pins, 16, 18–19, 141–142. See also GND and 5V power
printing to serial monitor, 273–276
programming language, reference guide, 115
programs. See sketches
projects
documenting and sharing, 348–350
writing up, 349
pushbutton, 7
pushing buttons, 238
PWM (pulse width modulation), 265–268. See also analog values
R
resistance. See also Ohm’s law
calculating, 359
defined, 168
impact on batteries, 176
impact on LEDs, 176
impact on resistors, 176
measuring, 168
multimeter measurement, 170–173
series and parallel, 192
voltage and current, 148–149, 177–180
water tank analogy, 168
resistors. See also 330-ohm resistor
accuracy, 357
body and wire leads, 351
buying, 54
checking, 58
current and voltage, 173
electrical model, 169
illustration, 7
numbering bands, 352
parallel arrangement, 181
and photoresistors, 284
series arrangement, 181
value calculation, 355
voltage, current, resistance, 176
voltage measurement, 156
robots, 343
S
saving sketches, 92
schematics. See also symbols
annotation, 119
and board, 116
explained, 37
LEDs in series, 186
potentiometer, 245
potentiometer circuit, 243
reading, 38
semicolon (;
) in code, 105–106
serial communication
input and output, 269
loop()
and delay()
, 276
serial functions, 277
serial monitor
running, 271
serial output, reading, 287–288
series
metering voltage of components, 187–188
series arrangement, Christmas lights, 190
server, 8
servo circuit
connector, 298
flag attached to horn, 297
removing horn, 297
schematic and drawing, 296
servo motors, 8, 287–288. See also LEA8_Knob sketch; motors and actuators
annotation, 294
degrees of rotation, 290
horns, 294
online vendors, 293
using, 289
wire colors, 295
setup()
function. See alsoloop()
function
curly braces ({}), 104
LEA4_Blink sketch, 99
pin mode, 108
positioning, 108
short circuit, 154. See also circuits
sketch window, 91
sketches
running, 95
soldering iron versus breadboard, 10–11
SOS signal light. See also LEA4_SOS sketch
flashes on and off, 128–132, 134
saving and renaming sketch, 126–128
spaghetti wiring, 349
SparkFun Electronics, 12
speaker. See 8 ohm speaker
start = positive, symbol, 39
statements, ending in code, 106
status bar, 94
stepper motors, 341
subtraction operators, 311
surge protector, 25
Sweep sketch. See LEA8_Sweep sketch
switches
and buttons, 206
buttons, 202
flipping, 266
functionality, 238
symbols. See also schematics
components, 40
DC current, 159
DC voltage, 175
electrical properties, 174
end = ground, 39
ohms, 168
parallel arrangement, 181
power and ground, 40
series arrangement, 181
start = positive, 39
T
tab (
), creating, 277
text, representing, 273
theremin, playing, 243, 285–286
three-button “Instrument” loop()
function, 235–236. See also buttons
tie points
tone()
and notone()
functions, 224–227, 239
trench, 46
two-button circuit, 228. See also buttons
U
ultrasonic sensors, 339
Uno version. See also Arduino
analog pins, 18
built-in LEDs, 18
On indicator LED, 18
input and output pins, 18
left side, 17
parts, 16
power and ground pins, 18
power port, 17
reset button, 17
right side, 18
tx and rx pins, 18
USB port, 17
unplugging Arduino, 23
uploading, 75
URLs. See websites
USB port
locating, 16
Uno version, 17
V
values
setting, 110
testing equality, 217
variables
const
, 212
explained, 208
names, 209
qualifiers, 211
void
in functions, 327
voltage. See also Ohm’s law
checking across components, 156–157, 159
components in parallel, 185–186
converting to analog reading, 260
current and resistance, 148–149, 173–180
defined, 152
determining, 179
explained, 175
impact on batteries, 176
impact on LEDs, 176
impact on resistors, 176
metering components in series, 187–188
metering on breadboard, 155
scaled measurement, 260
series and parallel, 192
symbols, 175
use by components, 159
water analogy, 150
voltage divider, 284
voltage value, mapping to, 264
voltage-to-analog conversion, 262
W
water tank analogy
resistance, 168
voltage, 150
wearable projects, 344
websites
Arduino programming language, 115
Arduino YÚN, 346
components, 12
Digi-Key Electronics, 12
forums, 336
IDE (integrated development environment), 76, 78, 80
inputs and outputs, 324
Jameco Electronics, 12
kits, 13
Micro Center, 12
Mouser Electronics, 12
note chart, 225
SparkFun Electronics, 12
Windows PC
wire strippers, 10
words, sending to serial monitor, 272–273
Z
zero volts, 152
3.19.31.73