& (ampersand) reference operator, 164, 170
* (asterisk) dereference operator, 164
storing data, 167
-> operator, retrieving data structure values with pointers, 174-176
; (semicolon), terminating statements, 77
-3 header socket port, 66
-5 header socket port, 66
-6 header socket port, 66
-9 header socket port, 66
-10 header socket port, 66
-11 header socket port, 66
2 header socket port, 66
3.3V header socket port, 65
4 header socket port, 66
5V header socket port, 65
7 header socket port, 66
8 header socket port, 66
12 header socket port, 66
13 header socket port, 66
A0 header socket port, 65
A1 header socket port, 65
A2 header socket port, 65
A3 header socket port, 65
A4 header socket port, 65
A5 header socket port, 65
abs() function, 85
accessing header sockets, 66
activating serial monitor, 53
Adafruit Data Logging shield, 376
ADC (analog-to-digital converter), 25, 236
Add File option (Sketch menu), 46
addition operator, 80
advanced math functions, 85
alphanumeric LCD devices, 319-320
ALU (Arithmetic Logic Unit), 24
ampersand (&) reference operator, 164, 170
input signals
detecting, 236
limiting values, 241
potentiometer example sketch, 238-241
reference voltage changes, 245-246
output signals, generating, 236-237, 246-247
analog output, 26
resistance-based sensors, 295-297
temperature LCD display example sketch, 327-329, 333-335
temperature logging example sketch, 382-384
temperature monitor example project
schematics, 392
temperature sensors for web servers, 361-364
voltage-based sensors, 288-293
converting voltage values, 292-293
temperature detection example sketch, 293-295
analogRead() function, 238, 291
analogReference() function, 245-246, 291
analog-to-digital converter (ADC), 25, 236
analogWrite() function, 246, 307
Archive Sketch option (Tools menu), 47
analog interfaces. See analog interfaces
communication between units, 280-284
controlling from web browser, 364-370
defined, 7
digital interfaces. See digital interfaces
interrupts
external interrupts, 252-253, 254-260
pin change interrupts, 253-254, 260-262
timer interrupts, 254, 262-264
memory
comparison among types, 181-182
creating dynamic variables, 185-189
models. See models of Arduino
powering on/off with USB hub, 69
shields. See shields
trademark protection, 9
Help menu commands, 48
installing
for Linux, 37
libraries, 201
compiling functions, 205
components of, 202
contributed libraries, 206-208
documentation, 205
example usage, 205-206, 212-214
including, 204
installing, 212
referencing functions in, 204-205
standard libraries, list of, 203-204
troubleshooting, 213
shield libraries, 32
Sketch menu commands, 46
toolbar, 49
Arduino programming language. See also C programming language
advanced math functions, 85
bit manipulation functions, 86
defining, 148
random number generators, 86
scope of variables, 154
troubleshooting, 148
user-defined, 147
creating and manipulating, 126-128
String object methods, 128-129
Arduino Starter Kit, 18
AREF header socket port, 66
arguments, 152
Arithmetic Logic Unit (ALU), 24
defined, 120
assigning values
to variables, 77
assignment statements
equality comparison versus, 96
equations versus, 82
asterisk (*) dereference operator, 164
storing data, 167
ATmega AVR microcontrollers, 9-10
memory, 25
instruction set, downloading, 27
Atmel Studio package, 30
attach() function, 313
attached() function, 313
attachInterrupt() function, 254-255
Auto Format option (Tools menu), 47
autoscroll() function, 325
Autoscroll option (serial monitor), 53
available() function
Serial library, 270
Wire library, 278
available method
EthernetClient class, 343
EthernetServer class, 345
EthernetUDP class, 347
File class, 377
AVR Libc project, 29
avr-gcc package, 30
baud rate, 271
Baud Rate option (serial monitor), 54
begin() function
LiquidCrystal library, 325
SPI library, 276
Wire library, 278
begin method
Ethernet class, 340
EthernetServer class, 345
EthernetUDP class, 347
SD class, 376
beginPacket method, 347
beginTransmission() function, 278
beta software, 33
binary calculations, 81
bit() function, 86
bit manipulation functions, 86
bitClear() function, 86
bitRead() function, 86
bitSet() function, 86
bitwise AND operator, 80
bitwise OR operator, 80
bitWrite() function, 86
blink() function, 325
blinking LED example sketch, 272-274, 280-284
Board option (Tools menu), 47
boolean data type, 77
Boolean logic, 81
bootloader, 42
uploading, 48
breadboards, 17
electronic circuit interfaces, 67-68
browsers, controlling Arduino from, 364-370
brushes in DC motors, 304
buffer overflow, 184
building
libraries
installing, 212
Burn Bootloader option (Tools menu), 48
byte data type, 77
C programming language, 28-29. See also Arduino programming language
Arduino IDE, 31-32. See also Arduino IDE
initializing, 176
endless loops, 106
multiple variables in, 112
operators
compound operators, 82
order of operations, 82
arithmetic with arrays, 168-171
printing, 166
storing data, 167
void pointers, 168
shield libraries, 32
statements, terminating, 77
compound conditions, 97
grouping multiple statements, 90-92
negating condition checks, 98
variables
assigning values, 77
qualifiers, 79
scope, 80
C++ programming language, library creation
header files, creating, 210-211
calculating factorials, 158-160
calling functions, 148-150, 158-160. See also referencing
camel case, 77
CapacitiveSensor library, 298-300
capacity classes (SD cards), 374
case statements, 99
CHANGE external interrupt mode, 255
changing
dynamic variables, 187
reference voltages, 245-246, 290-291
char data type, 77, 79, 119-120
character arrays. See arrays, strings
charAt method, 128
chat server example sketch, 349-351
circuits. See electronic circuits
clear() function, 325
Client class. See EthernetClient class
close method, 377
Close option (File menu), 42
code files in libraries, 202, 208-210
code libraries, 29
code listings. See listings
coding. See programming microcontrollers
comma-separated values (CSV) format, 380
Comment/Uncomment option (Edit menu), 45
communication
LCD (liquid crystal display) devices, 319
Arduino interface connections, 323-325
downloading and installing LCD shield library, 330-331
LCD shield connections, 332-333
LCD shield library functions, 331-332
LiquidCrystal library, 325-327
temperature display example sketch, 327-329, 333-335
troubleshooting, 329
serial communication protocols, 267-268
I2C (Inter-Integrated Circuit) protocol, 277-284
SPI (Serial Peripheral Interface) protocol, 274-277
compareTo method, 128
compound conditions, 97
negating condition checks, 98
string comparisons, 96, 125-126
compilers, 28
compiling
functions in standard libraries, 205
compound conditions, 97
compound operators, 82
concat method, 128
configuring Arduino IDE, 51-52
connect method, 343
CONNECT method token, 357
connected method, 343
connections. See also interfaces
console window (Arduino IDE), 49-50
const variable qualifier, 79
constants, 79
memory locations, 184
contrast on LCD devices, 329
contributed libraries, 206-208. See also building libraries
controllers, 24
converting voltage values in analog sensors, 292-293
Copy as HTML option (Edit menu), 44
Copy for Forum option (Edit menu), 44
Copy option (Edit menu), 44
copying
cos() function, 85
.cpp file extension, 202
programming
C programming language, 28-29. See also C programming language
machine code, 26
createChar() function, 325
CSV (comma-separated values) format, 380
current sinks, digital interfaces as, 222-223
current sources, digital interfaces as, 222-223
cursor() function, 325
Cut option (Edit menu), 44
DAC (digital-to-analog converter), 236-237
data display with LCD shield, 19
data pointers. See pointers
data registers, 24
initializing, 176
powering on/off, 305-306, 308-311
speed control, 306-307, 311-313
debugging sketches, 83. See also troubleshooting
declaring. See also defining
flash memory data types, 190-191
Decrease Indent option (Edit menu), 45
decrement operator, 80
default statements, 99
#define directive, 210
defining. See also declaring
functions, 148
delay() function, 84
delayMicroseconds() function, 84
DELETE method token, 357
dereference operators, 164
storing data, 167
detach() function, 313
detachInterrupt() function, 255
DHCP (Dynamic Host Configuration Protocol), 342-343
interface 13, 229
interrupts
pin change interrupts, 253-254, 260-262
timer interrupts, 254, 262-264
LCD (liquid crystal display) devices, 323-325
output voltage levels, 221-223
setting input/output modes, 221
SPI signals, 276
traffic signal example sketch, 223-226, 229-231, 364-370
troubleshooting
input voltage levels, 227
with serial monitor, 226
digitalRead() function, 226
digital-to-analog converter (DAC), 236-237
digitalWrite() function, 63, 221
direction of DC motors, controlling, 307-308
display() function, 325
displaying
data with LCD shield, 19
strings, 122
division operator, 80
documentation for standard libraries, 205
double data type, 77
downloading
ATmega AVR microcontroller instruction set, 27
contributed libraries, 206-208
Timer One library, 263
Due model, 13
analog interfaces, 236
digital interfaces, 219
I2C interface pins, 278
serial port interfaces, 269
voltage levels, 288
durability of SD cards, 375
Dynamic Host Configuration Protocol (DHCP), 342-343
changing, 187
removing, 187
Eagle circuit board software, 400-401
editor window (Arduino IDE), creating sketches, 59-60
EEPROM Extended library, 197
EEPROM library, 203
comparison with SRAM and flash memory, 181-182
EEPROMex library, 197
resistance-based sensors, 295-297
temperature LCD display example sketch, 327-329, 333-335
temperature logging example sketch, 382-384
temperature sensors for web servers, 361-364
voltage-based sensors, 288-295
breadboard circuits, creating, 393-394
for DC motors
interfacing with sketches, 64-69
analog output generation, 246-247
blinking LED example sketch, 272-274, 280-284
pin change interrupts, 261-262
potentiometer example sketch, 238-241
traffic signal example sketch, 223-226, 229-231, 364-370
prototype circuit boards, creating, 399-401
electronically erasable programmable read-only memory. See EEPROM memory
enabling external interrupts, 254-255
end() function
Serial library, 270
SPI library, 276
#endif directive, 210
endless loops, 106
endPacket method, 347
endsWith method, 128
endTransmission() function, 278
equality comparison, assignment statements versus, 96
equals method, 128
equalsIgnoreCase method, 128
equations, assignment statements versus, 82
Esplora library, 203
Esplora model, 14
Ethernet library, 203
Ethernet shield, 18-19, 337-338
Ethernet Shield library, 340
chat server example sketch, 349-351
EthernetClient class, 340, 343-345
EthernetServer class, 340, 345-347
EthernetUDP class, 340, 347-349
events, serial, 274
example sketches, modifying, 41
Examples option (File menu), 41
exFAT file format, 374
exists method, 376
traffic signal example sketch, 255-260
external memory, 182
external power sources, 17, 69
external reference voltages, 246
factorials, calculating, 158-160
FALLING external interrupt mode, 254
FAT16 file format, 374
file extensions for sketches, 41
file formats for SD cards, 374
files on SD cards
writing to, 379
find() function, 10
Find Next option (Edit menu), 45
Find option (Edit menu), 45
Find Previous option (Edit menu), 46
finding serial ports in Windows, 52
findUntil() function, 270
Fio model, 288
Firmata library, 203
Fix Encoding and Reload option (Tools menu), 47
comparison with SRAM and EEPROM, 181-182
float data type, 77
floating-point values, integer values versus, 78
flow control. See loops; structured commands
flush() function, 270
flush method
EthernetClient class, 343
File class, 377
flushing SD card data, 378
formatting sketches, 91
free() function, 187
functions
advanced math functions, 85
bit manipulation functions, 86
defining, 148
random number generators, 86
scope of variables, 154
troubleshooting, 148
user-defined, 147
compiling in standard libraries, 205
in EEPROM memory, 194
for flash memory access, 191
LiquidCrystal library, 325-326
private functions, 211
public functions, 211
referencing in standard libraries, 204-205
Servo library, 313
testing results, 97
gate leads in transistors, 305
GET method token, 357
getBytes method, 128
global variables, 80
memory locations, 184
overriding, 158
GND header socket ports, 65-66
graphical LCD devices, 319-320
grounding analog sensors, 290
grouping multiple statements
in else statements, 92
GSM library, 203
.h file extension, 202
hardware
open source hardware, 9
HD44780 controller chips, 321-322
HEAD method token, 357
header files in libraries, 202, 210-211
accessing, 66
electronic circuit interfaces, 64-66
headers (HTTP)
request headers, 358
response header lines, 360-361
changing, 187
removing, 187
Help menu commands, 48
highByte() function, 86
high-current devices, digital interface connections, 221-223
higher-level programming languages, 28-29
home() function, 325
HTML in sketches, 44
HTTP (Hypertext Transfer Protocol), 355
request headers, 358
request line, 357
response header lines, 360-361
I2C (Inter-Integrated Circuit) protocol, 277-284
blinking LED example sketch, 280-284
interfaces, 278
Wire library functions, 278-280
ICSP (in-circuit serial programming) header, 390
IDE (integrated development environment)
Help menu commands, 48
Linux installation, 37
shield libraries, 32
Sketch menu commands, 46
toolbar, 49
Atmel Studio package, 30
compound conditions, 97
grouping multiple statements, 90-92
negating condition checks, 98
#ifndef directive, 210
Import Library option (Sketch menu), 46
importing. See also installing
contributed libraries, 206-208
Timer One library, 263
in-circuit serial programming (ICSP) header, 390
#include directive, 58-59, 204
Ethernet Shield library, 340
header files, 208
standard libraries, 204
Increase Indent option (Edit menu), 45
increment operator, 80
index values (arrays), 110
indexOf method, 128
initializing data structures, 176
INPUT interface mode setting, 221
input mode
for analog interfaces
detecting signals, 236
limiting values, 241
potentiometer example sketch, 238-241
reference voltage changes, 245-246
for digital interfaces
setting, 221
traffic signal example sketch, 229-231
INPUT_PULLUP interface mode setting, 221, 228-229
installing. See also importing
Arduino IDE
for Linux, 37
libraries, 212
integer values, floating-point values versus, 78
integrated development environment (IDE). See IDE (integrated development environment)
interface 13 as input, 229
interfaces, 10-11. See also electronic circuits
analog interfaces. See also analog sensors
input signals, detecting, 236
limiting input values, 241
mapping input values, 242-245, 292
output signals, generating, 236-237, 246-247
potentiometer input example sketch, 238-241
reference voltage changes, 245-246
digital interfaces
interface 13, 229
output voltage levels, 221-223
setting input/output modes, 221
traffic signal example sketch, 223-226, 229-231
troubleshooting, 226
I2C (Inter-Integrated Circuit) protocol, 278
interrupts
pin change interrupts, 253-254, 260-262
timer interrupts, 254, 262-264
LCD (liquid crystal display) devices
Arduino interface connections, 323-325
LCD shield connections, 332-333
serial port interfaces, 268-269
sketches with electronic circuits, 64-69
SPI (Serial Peripheral Interface) protocol, 274-276
on Uno R3 unit, 15
Inter-Integrated Circuit (I2C) protocol, 277-284
blinking LED example sketch, 280-284
interfaces, 278
Wire library functions, 278-280
internal reference voltages, 245-246
interrupt service routine (ISR), 252, 255
interrupts
traffic signal example sketch, 255-260
pin change interrupts, 253-254
importing PinChangeInt library, 260-261
traffic signal example sketch, 261-262
timer interrupts, 254
importing Timer One library, 263
interrupts() function, 264-265
I/O interface in ATmega AVR microcontrollers, 25-26
IOREF header socket port, 65
IP addresses
isDirectory method, 377
ISR (interrupt service routine), 252, 255
kits, 18
lastIndexOf method, 128
LCD (liquid crystal display) devices, 319
Arduino interface connections, 323-325
downloading and installing library, 330-331
LiquidCrystal library
example usage, 327
temperature display example sketch, 327-329, 333-335
troubleshooting, 329
downloading and installing library, 330-331
temperature display example sketch, 333-335
LDR (light-dependent resistor), 296
LEDs
resistors and, 256
traffic signal example sketch. See traffic signal example sketch
WiFi shield, 339
left shift operator, 80
leftToRight() function, 325
legal issues, trademark protection of Arduino name, 9
length method, 128
Leonardo model, 13
analog interfaces, 236
digital interfaces, 219
external interrupts, 253
I2C interface pins, 278
libraries, 201
building
installing, 212
components of, 202
contributed libraries, 206-208
standard libraries
compiling functions, 205
documentation, 205
including, 204
referencing functions in, 204-205
troubleshooting, 213
light meter example sketch, 296-297
light sources for LCDs, 320-321
light-dependent resistor (LDR), 296
LilyPad model, 15
limiting analog input values, 241
Linux, Arduino IDE installation, 37
liquid crystal display. See LCD (liquid crystal display) devices
LiquidCrystal library, 203
example usage, 327
temperature display example sketch, 327-329
sketch0401 code, 59
sketch0602 code, 94
localIP method, 340
location of libraries, 202-203
logic flow control. See loops; structured commands
loop function, 58
endless loops, 106
LOW external interrupt mode, 255
lowByte() function, 86
low-current devices, digital interface connections, 221-223
MAC (Media Access Control) addresses, 341
machine code, 26
maintain method, 340
map() function, 85, 242-245, 292
mapping
analog input values, 242-245, 292
master mode (SPI), 274
max() function, 85
Media Access Control (MAC) addresses, 341
Mega model, 13
analog interfaces, 236
digital interfaces, 219
external interrupts, 253
I2C interface pins, 278
serial port interfaces, 269
in ATmega AVR microcontrollers, 9-10, 25
comparison among types, 181-182
creating dynamic variables, 185-189
pointers. See pointers
variables. See variables
memory address wrap, 195
memory collisions, 185
memory leaks, 185
menu bar
Help menu commands, 48
Sketch menu commands, 46
message area (Arduino IDE), 49-50
metal-oxide-semiconductor field-effect transistor (MOSFET), 306
method tokens (HTTP), 357
methods
Ethernet class, 340
EthernetClient class, 343
EthernetServer class, 345
EthernetUDP class, 347
String object methods
Micro model, 14
analog interfaces, 236
digital interfaces, 219
microcontrollers
ATmega AVR microcontrollers, 9-10
programming
Arduino programming language. See Arduino programming language
C programming language, 28-29. See also C programming language
machine code, 26
micros() function, 84
Micro-SD breakout board, 376
millis() function, 84
min() function, 85
Mini model
analog interfaces, 236
digital interfaces, 219
missing libraries, troubleshooting, 213
digital interfaces, number of, 219-220
Due, 13
Esplora, 14
Leonardo, 13
LilyPad, 15
Mega, 13
Micro, 14
modifying example sketches, 41
modulus operator, 80
MOSFET (metal-oxide-semiconductor field-effect transistor), 306
motors, 18
powering on/off, 305-306, 308-311
speed control, 306-307, 311-313
servo motors, 304
positioning example sketch, 314-316
stepper motors, 304
multiple statements, grouping
in else statements, 92
multiple variables in for statements, 112
multiplication operator, 80
multi-user environments, 207
name method, 377
naming conventions
constants, 79
negating condition checks, 98
negative LCD displays, 320-321
network connectivity
with Ethernet shield, 18-19, 337-338
chat server example sketch, 349-351
Ethernet Shield library, 340
with HTTP, 355
web browsers, controlling Arduino from, 364-370
web servers, building, 361-364
with WiFi shield, 339
New icon (toolbar), 49
New option (File menu), 40
Newline option (serial monitor), 54
noAutoscroll() function, 325
noBlink() function, 325
noCursor() function, 325
noDisplay() function, 325
nointerrupts() function, 264
null-terminated strings, 120
onReceive() function, 278
onRequest() function, 278
Open icon (toolbar), 49
Open option (File menu), 41
open source hardware, 9
openNextFile method, 377
operators
compound operators, 82
numeric comparisons, 95
order of operations, 82
pointer operators, 164
OPTIONS method token, 357
order of operations, 82
OS X
Arduino IDE installation, 36-37
zip file creation, 212
out of memory errors, troubleshooting, 186
OUTPUT interface mode setting, 221
output mode
for analog interfaces
generating signals, 236-237, 246-247
reference voltage changes, 245-246
for digital interfaces
setting, 221
traffic signal example sketch, 223-226
voltage levels, setting, 221-223
output of serial ports
viewing, 63
overflowing
LCD displays, 327
strings values, 122
overriding global variables, 158
Page Setup option (File menu), 43
parameters, 152
parseFloat() function, 270, 272
parsePacket method, 347
passing to functions
Paste option (Edit menu), 45
PCB (printed circuit board), 67
peek() function, 270
peek method, 377
personal libraries, location of, 203
pgm_read_byte() function, 191
pgm_read_word() function, 191
pgmspace.h library, 191
photoresistor example sketch, 296-297
pin change interrupts, 253-254
importing PinChangeInt library, 260-261
traffic signal example sketch, 261-262
PinChangeInt library, 253, 260-261
pinMode() function, 221
schematics, 392
PoE (Power over Ethernet), 338
arithmetic with arrays, 168-171
printing, 166
storing data, 167
void pointers, 168
polling, interrupts versus, 251-252
ports
lower header sockets, 65
upper header socket, 66
position method, 377
positioning servo motors example sketch, 314-316
positive LCD displays, 320-321
POST method token, 357
potentiometer example sketch
pow() function, 85
power, external sources, 17
Power over Ethernet (PoE), 338
powering on/off
Arduino with USB hub, 69
precedence in mathematical operations, 82
Preferences option (File menu), 43
print() function
LiquidCrystal library, 325
Serial library, 63, 83, 270-271
print method
EthernetClient class, 343
EthernetServer class, 345
File class, 377
Print option (File menu), 43
printed circuit board (PCB), 67
printing pointers, 166
println() function, 83, 270-271
println method
EthernetClient class, 343
EthernetServer class, 345
File class, 377
private functions, 211
Pro model, 288
processors on ATmega AVR microcontrollers, 9-10
prog_char flash data type, 190
prog_int16_t flash data type, 190
prog_int32_t flash data type, 190
prog_uchar flash data type, 190
prog_uint16_t flash data type, 190
prog_uint32_t flash data type, 190
PROGMEM keyword, 190
program counters, 24
Programmer option (Tools menu), 47
Arduino programming language. See Arduino programming language
C programming language, 28-29. See also C programming language
machine code, 26
programs. See sketches
project development
breadboards, creating circuits, 393-394
prototype circuit boards, creating, 399-401
with Prototype shield, 20
requirements
for analog interfaces, 389-390
for digital interfaces, 390-391
schematics, creating, 392
sketches
prototype circuit boards, creating, 399-401
public functions, 211
pulldown circuits, 228
PUT method token, 357
PuTTY package, 351
PWM (pulse-width modulation), 26, 237, 246, 306-307, 311-313
qualifiers for variables, 79
Quit option (File menu), 43
quotes for characters and strings, 121
random() function, 86
random number generators, 86
randomSeed() function, 86
RC circuits, 298
read() function
EEPROM library, 194
Servo library, 313
Wire library, 278
EthernetClient class, 343
EthernetUDP class, 347
File class, 377
readButtons() function, 331
readBytes() function, 270, 272
readBytesUntil() function, 270, 272
reading files on SD cards, 379-380
realloc() function, 187
Redo option (Edit menu), 44
reference voltages, changing, 245-246, 290-291
referencing. See also calling functions
Ethernet Shield library, 340
functions in standard libraries, 204-205
strings with pointers, 172-173
reformatting SD cards, 374
relays, 305
remoteIP method, 347
remotePort method, 347
remove method, 376
removing dynamic variables, 187
replace method, 128
request headers (HTTP), 358
request line (HTTP requests), 357
requestFrom() function, 278
request headers, 358
request line, 357
requirements, determining, 387-389
for analog interfaces, 389-390
for digital interfaces, 390-391
reserve method, 128
Reset button on Uno R3 unit, 17, 92
RESET header socket port, 65
resistance-based analog sensors, 295-297
LEDs and, 256
in motor circuits, 306
response header lines (HTTP), 360-361
response header lines, 360-361
retrieving data
with pointers, 166-167, 173-176
with serial ports, 272
return code (functions), testing, 97
return statement, 150
returning values
in pointers, 178
rewindDirectory method, 377
right shift operator, 80
rightToLeft() function, 325
RISING external interrupt mode, 254
Robot_Control library, 203
RS-232 serial interfaces, 269
RX <- 0 header socket port, 66
Save As option (File menu), 42
Save icon (toolbar), 49
Save option (File menu), 42
saving text editor files, 210
schematics, creating, 392
scope of variables, 80
in functions, 154
scrollDisplayLeft() function, 325
scrollDisplayRight() function, 325
files
writing to, 379
temperature logging example sketch, 382-384
Secure Digital. See SD cards
seek method, 377
Select All option (Edit menu), 45
semicolon (;), terminating statements, 77
sensitivity
of touch sensors, 300
of voltage-based analog sensors, 291-292
sensors, 18. See also analog sensors
serial communication protocols, 267-268
I2C (Inter-Integrated Circuit) protocol, 277-284
blinking LED example sketch, 280-284
interfaces, 278
Wire library functions, 278-280
blinking LED example sketch, 272-274
SPI (Serial Peripheral Interface) protocol, 274-277
serial events, 274
Serial library
interrupts in, 255
with external power source, 69
viewing serial port output, 63
Serial Monitor icon (toolbar), 49
Serial Monitor option (Tools menu), 47
Serial Peripheral Interface (SPI) protocol, 274-277, 390
Ethernet shield, 338
Serial Port option (Tools menu), 47
blinking LED example sketch, 272-274
finding in Windows, 52
output
viewing, 63
serialEvent() function, 274
Server class. See EthernetServer class
server communication protocols, 345
servo motors, 304
positioning example sketch, 314-316
setBacklightColor() function, 331
setBitOrder() function, 276-277
setCharAt method, 130
setClockDivider() function, 276-277
setCursor() function, 325
setDataMode() function, 276-277
setTimeout() function, 270
setup function, 58
shield libraries, 32. See also shields
defined, 18
Ethernet shield, 18-19, 337-338
chat server example sketch, 349-351
Ethernet Shield library, 340
downloading and installing library, 330-331
temperature display example sketch, 333-335
WiFi shield, 339
Show Sketch Folder option (Sketch menu), 46
signal duty cycle, 237
sin() function, 85
size method, 377
sizing arrays, 111-112, 121-122
Sketch menu commands, 46
Sketchbook option (File menu), 41
sketches. See also Arduino programming language; listings
analog sensor interfaces
photoresistor example sketch, 296-297
temperature detection example sketch, 293-295
temperature LCD display example sketch, 327-329, 333-335
temperature logging example sketch, 382-384
temperature sensors for web servers, 361-364
touch sensor example sketch, 298-300
chat server example sketch, 349-351
DC motors
debugging, 83
electronic circuit interfaces, 64-69
analog output generation, 246-247
blinking LED example sketch, 272-274, 280-284
pin change interrupts, 261-262
potentiometer example sketch, 238-241
traffic signal example sketch, 223-226, 229-231, 364-370
example sketches, modifying, 41
file extensions, 41
formatting, 91
HTML in, 44
servo motors, positioning, 314-316
slave mode (SPI), 274
accessing, 66
electronic circuit interfaces, 64-66
SoftwareSerial library, 203
speed of DC motors, controlling, 306-307, 311-313
SPI (Serial Peripheral Interface) protocol, 274-277, 390
Ethernet shield, 338
sqrt() function, 85
SRAM memory, 25
comparison with EEPROM and flash memory, 181-182
changing, 187
removing, 187
stack pointers, 24
standard libraries
compiling functions, 205
documentation, 205
including, 204
referencing functions in, 204-205
startsWith method, 128
statements, terminating, 77
static random-access memory. See SRAM memory
status codes (HTTP), list of, 359
status line (HTTP responses), 358-360
status registers, 24
Stepper library, 203
stepper motors, 304
stop method
EthernetClient class, 343
EthernetUDP class, 347
storage. See also memory
SD cards
temperature logging example sketch, 382-384
writing to files, 379
of strings, 78
of values with pointers, 167, 173-176
strcmp() function, 123, 125-126
strcmp_P() function, 191
strcpy() function, 123, 125, 137
strict typing, 76
creating and manipulating, 126-128
in data structures, 142
methods
in Arduino programming language, 126-129
creating and manipulating, 126-128
String object methods, 128-129
in C programming language, 120-126
comparisons, 96
copying, 125
displaying, 122
manipulating with pointers, 171-172
referencing with pointers, 172-173
storing, 78
strlen() function, 123
strlen_P() function, 191
strstr() function, 123
structured commands. See also loops
compound conditions, 97
negating condition checks, 98
string comparisons, 96
structures. See data structures
substring method, 128
subtraction operator, 80
tan() function, 85
Telnet clients, 351
temperature detection example sketch, 293-295
for LCD displays, 327-329, 333-335
temperature monitor example project
breadboard circuits, creating, 393-394
schematics, creating, 392
sketches
terminating statements, 77
testing
function results, 97
text. See strings
text editor files, saving, 210
TFT library, 203
timer interrupts, 254
importing Timer One library, 263
Timer One library, importing, 263
TMP36 sensor, 293-295, 361-364
toCharArray method, 128
toInt method, 128
toLowerCase method, 130
toolbar (Arduino IDE), 49
toUpperCase method, 130
TRACE method token, 357
trademark protection of Arduino name, 9
controlling from web browser, 364-370
pin change interrupts, 261-262
Transistor-transistor-logic (TTL)-level voltages, 269
trcpy_P() function, 191
trim method, 130
compiler errors, 61
debugging sketches, 83
digital interfaces
input voltage levels, 227
with serial monitor, 226
flushing SD card data, 378
functions, 148
importing PinChangeInt library, 261
LCD (liquid crystal display) devices, 329
memory
out of memory errors, 186
missing libraries, 213
modifying example sketches, 41
switch bounce, 260
TTL (Transistor-transistor-logic)-level voltages, 269
TX -> 1 header socket port, 66
.txt file extension, 210
Ubuntu, Arduino IDE installation, 37
UDP (User Datagram Protocol), 347-349
Undo option (Edit menu), 44
Universal Resource Indicator (URI), 357
unnamed data structures, 136
analog interfaces, 236
digital interfaces, 219
external interrupts, 253
I2C interface pins, 278
unsigned variable qualifier, 79
Upload icon (toolbar), 49
Upload option (File menu), 42
Upload Using Programmer option (File menu), 42
uploading
bootloader, 48
URI (Universal Resource Indicator), 357
USB A-B cables, 17
USB hub, powering on/off Arduino, 69
USB ports on Uno R3 unit, 16
USB serial interface, 268
Use Selection for Find option (Edit menu), 46
User Datagram Protocol (UDP), 347-349
user-created libraries. See building libraries
user-defined functions, 147
defining, 148
scope of variables, 154
troubleshooting, 148
values
analog input values
limiting, 241
assigning
to variables, 77
retrieving
with pointers, 166-167, 173-176
returning
in pointers, 178
storing with pointers, 167, 173-176
voltage values, converting, 292-293
variable resistors, 17
arrays. See arrays
assigning values, 77
data structures. See data structures
changing, 187
removing, 187
pointers. See pointers
qualifiers, 79
scope, 80
in functions, 154
viewing, 83
Verify icon (toolbar), 49
Verify/Compile option (Sketch menu), 46
viewing
serial port output, 63
variables, 83
Vin header socket port, 65
void data type, 148
void pointers, 168
voltage dividers, 289-290, 295-296
voltage levels
in capacitors, detecting, 297-298
for digital interfaces
reference voltages, changing, 245-246, 290-291
voltage-based analog sensors, 288-293
converting voltage values, 292-293
temperature detection example sketch, 293-295
Wave shield, 376
web browsers, controlling Arduino from, 364-370
web servers, building, 361-364, 366-370
Wifi library, 203
WiFi shield, 339
Windows
Arduino IDE installation, 33-36
serial ports, finding, 52
zip file creation, 211
wires, 17
word data type, 77
write() function
EEPROM library, 194
LiquidCrystal library, 325
Servo library, 313
Wire library, 278
write method
EthernetClient class, 343
EthernetServer class, 345
EthernetUDP class, 347
File class, 377
write speeds (SD cards), 374
writeMicroseconds() function, 313
writing
to files on SD cards, 379
analog interfaces, 236
digital interfaces, 219
3.145.179.35