Выбрать главу

Figure C-8 shows the board being assembled.

Figure C-8: Assembling the screwshield

To assemble the screwshield, follow these steps:

1. Solder the LEDs, resistors, and switch (assuming you want them) in place (Figure C-8a).

2. Put all the screw terminals in place along the outermost edges of the screwshield (Figure C-8b) and flip the board over to solder them on the underside of the PCB. Make sure they are the right way around so that the openings where the wires enter are facing outward, away from the board.

3. Push the pass-through headers through from the top of the board (Figure C-8c) and solder them. Notice that there are two rows of holes on each side of the board where they are able to go; place them in the outer sets of holes. The inner sets are used to wire things up to the pins on the central prototyping area of the board.

If you need a refresher on how to solder to a PCB, review “Soldering Basics” on page 230. With your components in place, make sure your solder joints look sound (also described in “Soldering Basics”). You should be ready to deploy this handy shield in all of your antizombie base defense endeavors and conserve precious solder for devices you intend to last a long time.

FURTHER RESOURCES

There are many great online resources and books that will tell you more about how to use the Arduino in your projects. Here are a few links to get you started:

• I have written a number of books on Arduino, including Programming Arduino: Getting Started with Sketches (Tab Books, 2012) and various Arduino project books. You can find a full list of my books at http://www.simonmonk.org/.

• Jeremy Blum, the technical editor of this book, has made a great series of introductory videos on the Arduino, which you can find here: https://www.youtube.com/playlist?list=PLA567CE235D39FA84.

• Jeremy also has written a great book on Arduino, called Exploring Arduino (Wiley, 2013).

• I have written a series of online Arduino lessons, the Adafruit “Learn Arduino” series, which you can find here: https://learn.adafruit.com/series/learn-arduino/.

INDEX

SYMBOLS AND NUMBERS

&& (and) operator, 257

* characters, 61

{ }, 250

== (double equal sign), 252

// (double slash), 250

|| (or) operator, 257

? command, 143, 144, 148

~ (tilde), 254

+5V pin, 150, 151

28 Days Later (film), 7

A

A (amperes), 23

AA batteries, 25

AC (alternating current), 23–24

adapters for converting to DC, 24

battery chargers powered by, 25

inverters for converting DC to, 24, 49–50

voltage range, on multimeters, 242

Adafruit “Learn Arduino” series, 261

Adafruit PIR module, 77

Adafruit’s ARDX Experimenters Kit for Arduino, 224

adapters

for converting AC to DC, 24

USB, 48–49

Address Resolution Protocol (ARP), 100

aircraft, 10

alarm function, 77, 130, 136

alarms. See PIR (passive infrared) detector; quiet fire alarm; temperature alarm; trip wire alarm

All_Sensors sketch, 76–77, 115, 129, 135, 142, 143, 144

alternating current. See AC (alternating current)

alternators, 25–26. See also bicycle generator

amperes (A), 23

analog inputs, on Arduino

reading, 253–254

writing to, 254

analog outputs, on Arduino, 255

analogRead command, 253

analogWrite command, 253

and (&&) operator, 257

antibiotics, 14

antiseptic, 14

App class, 146

apt-get package management software, 87

Arduino flash distractor, 158–169

constructing, 161–166

materials for, 160

software for, 166–168

using, 168–169

Arduino FM radio frequency hopper, 188–196

constructing, 189–194

materials for, 189

software for, 194–196

using, 196

Arduino IDE. See also Arduino programming

installing, 245–247

installing sketches, 248–249

serial monitor window, 247

setting serial port, 247–248

specifying type of board, 247

uploading sketches, 247–248

Arduino microcontroller board, 18

Arduino Uno, 243–244

assembling screwshield, 259–261

ATMega328 microcontroller integrated circuit (IC), 245

connection sockets, 244

DC power jack, 245

ICSP (InCircuit Serial Programming) header, 244

input and output pins, 244, 245

LEDs of, 244, 247, 260

measuring DC current drawn by, 239–240

overview, 243–245

projects using. See Arduino flash distractor; Arduino FM radio frequency hopper; Arduino Morse code beacon; Arduino movement and sound distractor; battery monitor; Bluetooth, wireless Raspberry Pi control center using; door sensor; haptic communicator; PIR (passive infrared) detector; quiet fire alarm; Raspberry Pi control center; temperature alarm

resources for learning more about, 261

restarting, 244

Arduino Morse code beacon, 196–207

constructing, 198–201

materials for, 197–198

software for, 201–205

using, 205–207

Arduino movement and sound distractor, 169–180

constructing, 171–177

materials for, 170

software for, 177–179

using, 180

Arduino programming, 249–259. See also Arduino IDE

configuring digital inputs, 251–252

configuring digital outputs, 251

creating variables and constants, 250

grouping code into functions, 257–259

making logical comparisons, 256–257

reading analog inputs, 253–254

repeating code in control loops, 254–256

setting two conditions with if/else, 256

stabilizing digital inputs with pull-up resistors, 252–253

structure of sketches, 249–250

writing to analog outputs, 254

ARDX Experimenters Kit for Arduino, 224

armor, 13

ARP (Address Resolution Protocol), 100

ATMega328 microcontroller integrated circuit (IC), 245

Auto power off, on multimeters, 242

axes, 11, 12

B

backlight, on multimeters, 242

backpacks, 14

barbecue grills, 11

barrel jack adapter, 160, 169

baseball bat, 11, 12

batteries, 24–25. See also battery monitor; car batteries

charging, 25–26

inserting in devices, 23

life of, 20

rechargeable, 25

single-use, 25

battery monitor, 53–61

constructing, 55–57

materials for, 54–55

software for, 57–61

using, 61

beep function, 179

bicycle generator, 34–43

constructing, 35–43

materials for, 35

using, 43

blink function, 258

Blink sketch

loop function in, 249, 250

setup function in, 249, 250

uploading, 247–248