100% found this document useful (3 votes)
33 views

Arduino Workshop A Hands On Introduction with 65 Projects 1st Edition John Boxall - Read the ebook online or download it to own the complete version

The document promotes the book 'Arduino Workshop: A Hands-On Introduction with 65 Projects' by John Boxall, which teaches readers how to use Arduino for various DIY projects. It provides links to download the book and other related ebooks, highlighting the practical applications of Arduino in electronics. The book includes a range of projects, from simple to complex, aimed at helping users learn and apply their knowledge effectively.

Uploaded by

mawdaminoo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
33 views

Arduino Workshop A Hands On Introduction with 65 Projects 1st Edition John Boxall - Read the ebook online or download it to own the complete version

The document promotes the book 'Arduino Workshop: A Hands-On Introduction with 65 Projects' by John Boxall, which teaches readers how to use Arduino for various DIY projects. It provides links to download the book and other related ebooks, highlighting the practical applications of Arduino in electronics. The book includes a range of projects, from simple to complex, aimed at helping users learn and apply their knowledge effectively.

Uploaded by

mawdaminoo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

Visit ebookfinal.

com to download the full version and


explore more ebooks or textbooks

Arduino Workshop A Hands On Introduction with 65


Projects 1st Edition John Boxall

_____ Click the link below to download _____


https://ebookfinal.com/download/arduino-workshop-a-hands-on-
introduction-with-65-projects-1st-edition-john-boxall/

Explore and download more ebooks or textbook at ebookfinal.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Make Sensors A Hands On Primer for Monitoring the Real


World With Arduino and Raspberry Pi 1st Edition Ville
Valtokari
https://ebookfinal.com/download/make-sensors-a-hands-on-primer-for-
monitoring-the-real-world-with-arduino-and-raspberry-pi-1st-edition-
ville-valtokari/

Arduino Robotic Projects 1st Edition Grimmett

https://ebookfinal.com/download/arduino-robotic-projects-1st-edition-
grimmett/

A Hands On Introduction to Machine Learning 1st Edition


Shah

https://ebookfinal.com/download/a-hands-on-introduction-to-machine-
learning-1st-edition-shah/

Count like an Egyptian a hands on introduction to ancient


mathematics 1st Edition Reimer

https://ebookfinal.com/download/count-like-an-egyptian-a-hands-on-
introduction-to-ancient-mathematics-1st-edition-reimer/
Arduino Projects to Save the World 1st Edition Emery
Premeaux

https://ebookfinal.com/download/arduino-projects-to-save-the-
world-1st-edition-emery-premeaux/

30 Arduino Projects for the Evil Genius 1st Edition Simon


Monk

https://ebookfinal.com/download/30-arduino-projects-for-the-evil-
genius-1st-edition-simon-monk/

Arduino Robotics 1st Edition John-David Warren

https://ebookfinal.com/download/arduino-robotics-1st-edition-john-
david-warren/

Microservices for Java developers a hands on introduction


to frameworks and containers First Edition. Edition Posta

https://ebookfinal.com/download/microservices-for-java-developers-a-
hands-on-introduction-to-frameworks-and-containers-first-edition-
edition-posta/

Warhammer 40 000 Codex Supplement Iron Hands 8th Edition


Games Workshop

https://ebookfinal.com/download/warhammer-40-000-codex-supplement-
iron-hands-8th-edition-games-workshop/
Arduino Workshop A Hands On Introduction with 65
Projects 1st Edition John Boxall Digital Instant Download
Author(s): John Boxall
ISBN(s): 9781593274481, 1593274483
Edition: 1st
File Details: PDF, 10.14 MB
Year: 2013
Language: english
ARDUINO
LEARN THE BASICS,
BUILD THE PROJECTS,
CREATE YOUR OWN

WORKSHOP

ARDUINO WORKSHOP
The Arduino is a cheap, flexible, open source micro- • A handy tester that lets you check the voltage of any A HANDS-ON INTRODUCTION
controller platform designed to make it easy for hobbyists single-cell battery
W I T H 65 PROJECTS
to use electronics in homemade projects. With an almost • A keypad-controlled lock that requires a secret code
unlimited range of input and output add-ons, sensors, indi- to open
cators, displays, motors, and more, the Arduino offers you
countless ways to create devices that interact with the You’ll also learn to build Arduino toys and games like: JOHN BOXALL
world around you. • An electronic version of the classic six-sided die
In Arduino Workshop, you’ll learn how these add-ons • A binary quiz game that challenges your number
work and how to integrate them into your own projects. conversion skills
You’ll start off with an overview of the Arduino system
but quickly move on to coverage of various electronic • A motorized remote control tank with collision detection
components and concepts. Hands-on projects throughout to keep it from crashing
the book reinforce what you’ve learned and show you Arduino Workshop will teach you the tricks and design
how to apply that knowledge. As your understanding grows, principles of a master craftsman. Whatever your skill level,
the projects increase in complexity and sophistication. you’ll have fun as you learn to harness the power of the
Among the book’s 65 projects are useful devices like: Arduino for your own DIY projects.

• A digital thermometer that charts temperature changes


ABOUT THE AUTHOR
on an LCD
John Boxall (http://www.tronixstuff.com/ ) has been
• A GPS logger that records data from your travels, which
writing Arduino tutorials, projects, and kit and accessory
can be displayed on Google Maps
reviews for years. Arduino Workshop is his first book.

T H E F I N E ST I N G E E K E N T E RTA I N M E N T ™
w w w.nostarch.com
BOXALL

“ I L I E F L AT .” $29.95 ($31.95 CDN)


This book uses RepKover — a durable binding that won’t snap shut.
HARDWARE/ELECTRONICS
SHELVE IN:
Arduino Workshop
A r d ui n o
W or k s h o p
A Hands-On Introduction
with 65 Projects

by John Boxall

San Francisco
Arduino Workshop. Copyright © 2013 by John Boxall.

All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic
or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the
prior written permission of the copyright owner and the publisher.

Printed in USA

First printing

17 16 15 14 13   1 2 3 4 5 6 7 8 9

ISBN-10: 1-59327-448-3
ISBN-13: 978-1-59327-448-1

Publisher: William Pollock


Production Editor: Serena Yang
Cover Illustration: Charlie Wylie
Interior Design: Octopod Studios
Developmental Editor: William Pollock
Technical Reviewer: Marc Alexander
Copyeditor: Lisa Theobald
Compositor: Susan Glinert Stevens
Proofreader: Emelie Battaglia

Circuit diagrams made using Fritzing (http://fritzing.org/)

For information on distribution, translations, or bulk sales, please contact No Starch Press, Inc. directly:

No Starch Press, Inc.


38 Ringold Street, San Francisco, CA 94103
phone: 415.863.9900; fax: 415.863.9950; info@nostarch.com; www.nostarch.com

Library of Congress Cataloging-in-Publication Data


A catalog record of this book is available from the Library of Congress.

No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and
company names mentioned herein may be the trademarks of their respective owners. Rather than use a trademark
symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to
the benefit of the trademark owner, with no intention of infringement of the trademark.

The information in this book is distributed on an “As Is” basis, without warranty. While every precaution has been
taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any liability to any
person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the infor-
mation contained in it.
For the two people who have always believed in me:
my mother and my dearest Kathleen
Brief Contents

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix

Chapter 1: Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Chapter 2: Exploring the Arduino Board and the IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Chapter 3: First Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Chapter 4: Building Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

Chapter 5: Working with Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

Chapter 6: Numbers, Variables, and Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

Chapter 7: Liquid Crystal Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

Chapter 8: Expanding Your Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

Chapter 9: Numeric Keypads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187

Chapter 10: Accepting User Input with Touchscreens . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

Chapter 11: Meet the Arduino Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

Chapter 12: Motors and Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225

Chapter 13: Using GPS with Your Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

Chapter 14: Wireless Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271

Chapter 15: Infrared Remote Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

Chapter 16: Reading RFID Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295


Chapter 17: Data Buses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307

Chapter 18: Real-time Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

Chapter 19: The Internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337

Chapter 20: Cellular Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365

viii   Brief Contents
Conte nt s in De ta il

Acknowledgments xix

1
Getting Started 1
The Possibilities Are Endless . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Strength in Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Parts and Accessories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Required Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Windows XP and Later . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Ubuntu Linux 9.04 and Later . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

2
Exploring the Arduino Board and the IDE 19
The Arduino Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Taking a Look Around the IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
The Command Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
The Text Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
The Message Window Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Creating Your First Sketch in the IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
The Setup Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Controlling the Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
The Loop Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Verifying Your Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Uploading and Running Your Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Modifying Your Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

3
First Steps 33
Planning Your Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
About Electricity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Current . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Electronic Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
The Resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
The Light-Emitting Diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
The Solderless Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Project #1: Creating a Blinking LED Wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
The Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Running the Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Using Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Project #2: Repeating with for Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Varying LED Brightness with Pulse-Width Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Project #3: Demonstrating PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
More Electric Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
The Transistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
The Rectifier Diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
The Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Higher-Voltage Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

4
Building Blocks 55
Using Schematic Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Identifying Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Wires in Schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Dissecting a Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
The Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Measuring the Capacity of a Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Reading Capacitor Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Types of Capacitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Digital Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Project #4: Demonstrating a Digital Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
The Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Modifying Your Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Understanding the Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Creating Constants with #define . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Reading Digital Input Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Making Decisions with if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Making More Decisions with if-then-else . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Boolean Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Making Two or More Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Project #5: Controlling Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
The Goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
The Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Running the Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Analog vs. Digital Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Project #6: Creating a Single-Cell Battery Tester . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
The Goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
The Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

x Contents in Detail
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Doing Arithmetic with an Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Float Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Comparison Operators for Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Improving Analog Measurement Precision with a Reference Voltage . . . . . . . . . . . . . . . 84
Using an External Reference Voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Using the Internal Reference Voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
The Variable Resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Piezoelectric Buzzers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Piezo Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Project #7: Trying Out a Piezo Buzzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Project #8: Creating a Quick-Read Thermometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
The Goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Hacking the Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

5
Working with Functions 95
Project #9: Creating a Function to Repeat an Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Project #10: Creating a Function to Set the Number of Blinks . . . . . . . . . . . . . . . . . . . . . . 97
Creating a Function to Return a Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Project #11: Creating a Quick-Read Thermometer That Blinks the Temperature . . . . . . . . . 98
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Displaying Data from the Arduino in the Serial Monitor . . . . . . . . . . . . . . . . . . . . . . . 101
The Serial Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Project #12: Displaying the Temperature in the Serial Monitor . . . . . . . . . . . . . . . . . . . . 103
Debugging with the Serial Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Making Decisions with while Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
do-while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Sending Data from the Serial Monitor to the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . 106
Project #13: Multiplying a Number by Two . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
long Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Project #14: Using long Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

6
Numbers, Variables, and Arithmetic 111
Generating Random Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Using Ambient Current to Generate a Random Number . . . . . . . . . . . . . . . . 112
Project #15: Creating an Electronic Die . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Modifying the Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

Contents in Detail xi
A Quick Course in Binary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Byte Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Increasing Digital Outputs with Shift Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Project #16: Creating an LED Binary Number Display . . . . . . . . . . . . . . . . . . . . . . . . . . 119
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Connecting the 74HC595 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Project #17: Making a Binary Quiz Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
The Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Defining an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Referring to Values in an Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Writing to and Reading from Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Seven-Segment LED Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Controlling the LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Project #18: Creating a Single-Digit Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Displaying Double Digits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Project #19: Controlling Two Seven-Segment LED Display Modules . . . . . . . . . . . . . . . . 131
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Modulo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Project #20: Creating a Digital Thermometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
LED Matrix Display Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
The LED Matrix Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Making the Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Bitwise Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
The Bitwise AND Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
The Bitwise OR Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
The Bitwise XOR Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
The Bitwise NOT Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Bitshift Left and Right . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Project #21: Creating an LED Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Project #22: Creating Images on an LED Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Project #23: Displaying an Image on an LED Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Project #24: Animating an LED Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

7
Liquid Crystal Displays 147
Character LCD Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Using a Character LCD in a Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Displaying Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Displaying Variables or Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

xii Contents in Detail


Project #25: Defining Custom Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Graphic LCD Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Connecting the Graphic LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Using the LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Controlling the Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Project #26: Seeing the Text Functions in Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Creating More Complex Display Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Project #27: Creating a Temperature History Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . 157
The Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
The Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Modifying the Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

8
Expanding Your Arduino 161
Shields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
ProtoShields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Project #28: Creating a Custom Shield with Eight LEDs . . . . . . . . . . . . . . . . . . . . . . . . . 165
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
The Layout of the ProtoShield Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
The Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Soldering the Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Modifying the Custom Shield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Expanding Sketches with Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Importing a Shield’s Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
MicroSD Memory Cards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Testing Your MicroSD Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Project #29: Writing Data to the Memory Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Project #30: Creating a Temperature-Logging Device . . . . . . . . . . . . . . . . . . . . . . . . . . 177
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Timing Applications with millis() and micros() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Project #31: Creating a Stopwatch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Interrupt Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Configuring Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Activating or Deactivating Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Project #32: Using Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186

Contents in Detail xiii


9
Numeric Keypads 187
Using a Numeric Keypad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Wiring a Keypad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Programming for the Keypad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Testing the Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Making Decisions with switch-case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Project #33: Creating a Keypad-Controlled Lock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Testing the Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

10
Accepting User Input with Touchscreens 195
Touchscreens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Connecting the Touchscreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Project #34: Addressing Areas on the Touchscreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Testing the Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Mapping the Touchscreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Project #35: Creating a Two-Zone On/Off Touch Switch . . . . . . . . . . . . . . . . . . . . . . . . 200
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Testing the Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Project #36: Creating a Three-Zone Touch Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
The Touchscreen Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

11
Meet the Arduino Family 207
Project #37: Creating Your Own Breadboard Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . 208
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Running a Test Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
The Many Arduino Boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Arduino Uno . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Freetronics Eleven . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
The Freeduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
The Boarduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
The Arduino Nano . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
The Arduino LilyPad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
The Arduino Mega 2560 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
The Freetronics EtherMega . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
The Arduino Due . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

xiv Contents in Detail


12
Motors and Movement 225
Making Small Motions with Servos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Selecting a Servo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Connecting a Servo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Putting a Servo to Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Project #38: Building an Analog Thermometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Using Electric Motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
The TIP120 Darlington Transistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Project #39: Controlling the Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Project #40: Building and Controlling a Tank Robot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Sensing Collisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Project #41: Detecting Tank Bot Collisions with a Microswitch . . . . . . . . . . . . . . . . . . . . 243
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Infrared Distance Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Wiring It Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Testing the IR Distance Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Project #42: Detecting Tank Bot Collisions with IR Distance Sensor . . . . . . . . . . . . . . . . . 249
Ultrasonic Distance Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Connecting the Ultrasonic Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Using the Ultrasonic Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Testing the Ultrasonic Distance Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Project #43: Detecting Tank Bot Collisions with an Ultrasonic Distance Sensor . . . . . . . . 254
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256

13
Using GPS with Your Arduino 257
What Is GPS? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Testing the GPS Shield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Project #44: Creating a Simple GPS Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Displaying the Position on the LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Project #45: Creating an Accurate GPS-based Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264

Contents in Detail xv
Project #46: Recording the Position of a Moving Object over Time . . . . . . . . . . . . . . . . . 265
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Displaying Locations on a Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

14
Wireless Data 271
Using Low-cost Wireless Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Project #47: Creating a Wireless Remote Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
The Hardware for the Transmitter Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
The Transmitter Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
The Hardware for the Receiver Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
The Receiver Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
The Transmitter Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
The Receiver Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
Using XBee Wireless Data Modules for Greater Range and Faster Speed . . . . . . . . . . 277
Project #48: Transmitting Data with an XBee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Setting Up the Computer to Receive Data . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Project #49: Building a Remote Control Thermometer . . . . . . . . . . . . . . . . . . . . . . . . . . 281
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
The Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284

15
Infrared Remote Control 285
What Is Infrared? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Setting Up for Infrared . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
The IR Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
The Remote Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
A Test Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Testing the Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Project #50: Creating an IR Remote Control Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Expanding the Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Project #51: Creating an IR Remote Control Tank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293

16
Reading RFID Tags 295
Inside RFID Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Testing the Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Testing the Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297

xvi Contents in Detail


Project #52: Creating a Simple RFID Control System . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Storing Data in the Arduino’s Built-in EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Reading and Writing to the EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Project #53: Creating an RFID Control with “Last Action” Memory . . . . . . . . . . . . . . . . . 303
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306

17
Data Buses 307
2
The I C Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Project #54: Using an External EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
The Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Project #55: Using a Port Expander IC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
The SPI Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Pin Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Implementing the SPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Sending Data to an SPI Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Project #56: Using a Digital Rheostat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

18
Real-time Clocks 321
Connecting the RTC Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
Project #57: Adding and Displaying Time and Date with an RTC . . . . . . . . . . . . . . . . . . . 322
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Project #58: Creating a Simple Digital Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
How It Works and Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
Project #59: Creating an RFID Time-Clock System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336

Contents in Detail xvii


19
The Internet 337
What You’ll Need . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Project #60: Building a Remote-Monitoring Station . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Project #61: Creating an Arduino Tweeter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Controlling Your Arduino from the Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
Project #62: Setting Up a Remote Control for Your Arduino . . . . . . . . . . . . . . . . . . . . . . 345
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Controlling Your Arduino Remotely . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348

20
Cellular Communications 349
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
Preparing the Power Shield . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Hardware Configuration and Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
Changing the Operating Frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Project #63: Building an Arduino Dialer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Project #64: Building an Arduino Texter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
Project #65: Setting Up an SMS Remote Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
The Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
The Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
The Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364

Index 365

xviii Contents in Detail


Acknowledgments

First of all, a huge thank you to the Arduino team:


Massimo Banzi, David Cuartielles, Tom Igoe,
Gianluca Martino, and David Mellis. Without your
vision, thought, and hard work, none of this would
have been possible.
Many thanks to my technical reviewer Marc Alexander for his contribu-
tions, expertise, suggestions, support, thoughts, and long conversations,
and for having the tenacity to follow through with such a large project.
I also want to thank the following organizations for their images and
encouragement: adafruit industries, Agilent Technologies, Gravitech,
Freetronics, Oomlout, Seeed Studio, Sharp Corporation, and SparkFun.
Furthermore, a big thanks to Freetronics for the use of their excellent
hardware products. And thank you to all those who have contributed their
time making Arduino libraries, which makes life much easier for everyone.
Kudos and thanks to the Fritzing team for their wonderful open source
circuit schematic design tool, which I’ve used throughout this book.
Discovering Diverse Content Through
Random Scribd Documents
those among whom he had cast his lot. He accepted it with outward
stoicism, but inwardly it humiliated him to the very marrow of his
bones. His work led him to the roughest part of the then thinly
settled West. It was no place for a woman and least of all for a girl
like Angela, who had never been outside of her native county three
times in her life.
When Angela got a letter from Neville she always went immediately
to Mrs. Tremaine and told her what was in the letter. Mrs. Tremaine
received this in perfect silence, but she was always tremulous for a
day or two afterwards. She, who had heretofore possessed a sort of
calm alertness, went about now with a strange preoccupation.
Neville’s room had been closed and locked and Mrs. Tremaine kept
the key. In it were some of his boyish books and belongings, but
Mrs. Tremaine made no offer of them to Angela. There were times
when she would disappear for an hour or so, and all at Harrowby
knew that she spent those stolen hours in Neville’s dark and
dismantled room. She paid these visits secretly, and would not even
speak of them to Colonel Tremaine, although once or twice he met
her coming out of the door, and his eyes, full of pain and sympathy,
tried to meet her averted gaze.
Every night at prayer time when the moment came that Neville’s
name had once been mentioned, Mrs. Tremaine could not control a
slight agitation, and once at the omission Colonel Tremaine groaned
aloud.
At that, Mammy Tulip, suddenly throwing her white apron over her
face, broke into loud weeping. “My chile,” she cried. “Dat boy I nus
same like he wuz my own an’ ain’t never gib he mammy a impident
word sence he been born, an’ now he ma an’ pa doan’ name him at
pray’r time.”
Angela went up to Mammy Tulip and, putting her arm around the old
woman’s neck, leaned upon her broad shoulder, her heart wrung
with pity for Neville. But even in that moment she knew that she
was not in love with him.
With the early summer the stupendous clamor of war and the
carnival of blood began.
Richard Tremaine’s battery had been ordered to the front and was in
most of the great battles of the summer of 1861. Often long periods
of time passed when no news of him reached Harrowby. The
Richmond newspapers, received twice in the week, which had been
leisurely read two or three days after they arrived, were now seized
upon with avidity, and the grewsome list of dead, wounded, and
missing was scanned with anxious eyes by Colonel Tremaine.
Angela, hovering about him as he read over this direful list, would
glance at it herself. Suppose she should find Isabey’s name in it.
How would she take it? She had never fainted in her life, but she
had a haunting fear that if she should read Isabey’s name among
the killed she should faint or shriek or in some way betray herself.
Madame Isabey was keyed up also to periods of anxiety, although
she showed a spirit of cheerfulness and courage which was
remarkable. The life at Harrowby, so placid without, was full of fears
and tumults within, and was extraordinarily different from the years
of pleasuring which Madame Isabey had spent between New Orleans
and Paris, but she made no complaint, nor did Adrienne, though, if
anything, it was harder on her than on the older lady.
Adrienne had few resources, music being the chief. But with natural
tact she forbore from spending long hours at the piano, which she
would have done in her own home. Her taste for reading lay in a few
pessimistic French poets and romancers, but even with these, the
time was heavy on her hands. She had found life disappointing from
the first. Formed for love, her first marriage had been as loveless as
it was respectable. Then had come a mortal wound to her pride—
when she was free Isabey no longer cared. It was not as if they had
been separated and her image had gradually faded from his mind;
they had been thrown constantly together during the seven years of
her widowhood, and all their world was continually suggesting the
appropriateness of their marriage. So that the idea of it was
necessarily before Isabey’s mind, yet he had spoken no word, and
Adrienne felt a sad certainty that no word would be spoken by him.
She had a quiet pride which not even jealousy could lash into
resentment. She saw the sudden witchery which this nineteen-year-
old Angela, this wife who was no wife, had cast over Isabey, and did
not wonder at it. Angela was to Adrienne as much an unknown
quantity as she herself was to Angela. Adrienne felt herself robbed
of something which could be of no use to Angela, who possessed it,
and Adrienne was thirty with her youth behind her while Angela, not
yet twenty, was entering upon those ten years which to most women
count for more than all that has gone before or can come after.
The most unfailing courtesy prevailed between these two women.
They exchanged small kindnesses, spent some hours of every day
together in feminine employment, but a great gulf lay between
them.
Angela felt instinctively and intuitively the things which Adrienne
knew, and reasoned upon them calmly and sadly. Adrienne had
everything and yet she had nothing. A still and mortal antagonism
had been growing steadily from the first between the women, but
not the smallest indication of it was given in manner or behavior.
Both were women of the highest breeding, and each was secretly
ashamed of the ignoble passion of jealousy which possessed them,
and had the art to conceal it.
Something of what each suffered was dimly suspected by the other
and was actually known to one person—Lyddon. Of the two, he felt
more sorry for Adrienne, torn from a life of gayety brightened by art
and music, and transplanted like an exquisite exotic into the depths
of a sunless forest. He felt acutely sorry for her and tried in many
ways to lighten the burden of ennui which he suspected, in spite of
her composure, lay heavy upon her. But there was no common
ground between them.
Lyddon, observing Angela day by day, saw her, as it were, growing
up. In January she had been a child: in July she was a woman with
more problems and perplexities weighing upon her than happen to
most women during the course of a long life.
Everyone at Harrowby was in a state of unrest, the negroes not the
least so. Several of the house servants could read, and occasionally
newspapers would disappear mysteriously and after a time be
replaced.
In the summer nights these children of the sun would build a fire out
of doors in their quarters, and sitting around it in a circle, the house
servants would tell in whispers what they had picked up of the great
events going on.
The early autumn in warm climates is a depressing time of feverish
heat alternating with shivery nights like the fever and ague which
was certain to appear at that season. In November, when the cool
weather had declared itself and all danger of fever was supposed to
be passed, Madame Isabey had a slight touch of it. In a great fright
she determined to go to Richmond, where she might consult a
doctor. Adrienne, of course, must go with her, so it was arranged
that the two ladies, late in autumn, should leave Harrowby for the
winter in the Confederate capital.
Adrienne looked forward to it with something like pleasure. Life at
Harrowby was wearing on her. She felt its sameness, which was now
without serenity, and the exciting and kaleidoscopic life of a
beleaguered capital would be a distraction to her. Adrienne’s
problems were not inconsiderable.
In December, therefore, the hegira occurred. The whole journey to
Richmond was made by carriage and took three days. Colonel
Tremaine, in the excess of gallantry and good will, declared to
Madame Isabey: “My boy, Hector, madame, shall drive the coach
upon this occasion, and I will cheerfully do without his services in
order to feel sure that you are in safe hands.”
“O Heavens!” cried Madame Isabey, who abhorred Hector. “That
ridiculous old creature, always getting tipsy and quoting the Bible
and telling romances—such romances! About the war in Mexico! And
you, yourself, my dear Colonel, tell me that the creature is a grand
coward. Never can I let him drive me!”
Colonel Tremaine colored with displeasure. Not even Mrs. Tremaine
had dared to speak the truth so openly about Hector. But the
courtesy due a guest made the Colonel pass over Madame Isabey’s
frankness.
“I, madame,” he responded, a little stiffly, after a moment, “shall
have the pleasure of accompanying you, as I always intended. I
could not think of allowing two ladies to travel from Harrowby to
Richmond alone, although I do not believe that any actual danger
may be apprehended.”
“Until Hector gets drunk and upsets the carriage in a ditch,”
whispered Lyddon to Angela, who was present.
The start was made on a bright morning in the middle of December.
The Harrowby carriage, like all those of the period, had boxes under
the seats meant to carry clothes and a rack behind for a trunk, and
that accommodated the ladies’ luggage. In addition was a large box
filled with provisions and with a dozen bottles of Mrs. Tremaine’s
very best blackberry wine, for supplies were scarce and dear in
Richmond. It was arranged that the ladies should return in April.
To themselves and to all the family at Harrowby, except Archie, there
was a slight feeling of relief at the separation for the winter. Archie
had become devotedly attached to Madame Isabey and insisted on
following the carriage on horseback a day’s journey to show his
regret at parting with his elderly friend, who never ceased to amuse
and delight him.
The parting was courtesy itself on both sides. Mrs. Tremaine
accepted as a certainty that the ladies would return in April to
remain during their pleasure. Many of the county families had guests
upon the same indefinite terms, and the arrangement was thought
in no way remarkable.
Madame Isabey and Adrienne both expressed the deepest gratitude
for the kindness shown them, and promised to return in the spring.
Yet there was a certain and secret feeling of satisfaction on both
sides when the carriage drove off.
Colonel Tremaine sat by Hector’s side upon the box to see that he
did not upset the carriage at the first opportunity, and Archie, like a
true cavalier, galloped by the carriage window. He was not expected
to return until the morrow. But at sunset on the same day he was
seen riding rapidly down the wide cedar-bordered lane. Angela, who
was returning from an afternoon walk with Lyddon, said to him:
“Archie must bring bad news.”
So thought Mrs. Tremaine, who saw him from the window and came
out on the porch to meet him.
“It’s nothing, mother!” he cried, “only Richard is a little ill in
Richmond. He caught the measles, just think of it, just think of it!
And father met a messenger coming to tell us of it. He sent me back
to tell you and to say that if you start at once you will be able to
catch up with him at King William Court House to-morrow night,
where he will sleep. I am to drive you in the Stanhope gig.”
“I shall be ready to start in half an hour,” replied Mrs. Tremaine
without a moment’s hesitation.
Immediately preparations were begun for her departure. Angela
followed her, anxious to be of service, and to her Mrs. Tremaine gave
the keys and a few household directions. Angela had taken a share
in housekeeping since she was twelve years old and accepted the
responsibility now laid upon her as the most natural thing in the
world. Most of the autumn labor on the estate was over; the
negroes’ clothes and shoes were made, and the winter provisions
laid in. The chief thing to be attended to was an army of turkeys,
ducks, and chickens, and Mammy Tulip, as an expert, had charge of
the fowl yard.
Only one thing remained to be arranged, and that a difficult matter.
How was Mrs. Tremaine to get news of Neville when his letters to
Angela came? Pride forbade her to ask, but Angela, who knew what
was in her mind, said gently to her as she tied Mrs. Tremaine’s
bonnet strings for her: “Whenever I hear from Neville, Aunt Sophia,
I will let you know.”
Mrs. Tremaine made no reply in words, but her eyes were eloquent.
It was arranged if Richard’s illness was slight, as was supposed, that
Colonel Tremaine would probably return, while Mrs. Tremaine would
remain with Richard in the little town near Richmond where he had
been taken ill.
After Mrs. Tremaine had left the house which had been so populous
only the day before, it had in it but two occupants—Angela and
Lyddon. George Charteris came over every day to do lessons with
Lyddon, but he avoided Angela, and she, while indifferent to his
dislike, kept out of his way.
It had been Mrs. Tremaine’s parting injunction to Angela to have
family prayers for the servants, and so at half past nine o’clock on
the first evening, the servants were all assembled in the library as
usual. Angela read the Gospel, as Colonel Tremaine did, and then
followed closely Mrs. Tremaine’s simple prayer, but when she prayed
for “the sons of this house,” she named Neville first, as had been the
case from the day of his birth until the day of his defection. A loud
Amen burst from Mammy Tulip, followed by a dozen other Amens
from the other servants. When the negroes’ Amens had died away,
Lyddon said distinctly, “Amen!”
Prayers being over, the servants dispersed, and all the house closed
for the night, Angela, as usual, went into the study, and sat an hour
with Lyddon. In the perplexities and the strange events which had
arisen in her life, she had found great comfort in Lyddon. His talk to
her always subtly conveyed the lesson of endurance, and after being
with him, Angela always felt more able to endure. He brought before
her the elemental fact that all the griefs, disappointments,
perplexities, and passions of human life were to be found in the
smallest circle, nay, under every roof.
The conduct of the house and estate, even for a short time, gave
Angela much to do, and in the days that followed she had but little
time to think. It was a full week before any news came of the
travelers. Then arrived a letter from Colonel Tremaine saying that he
and Mrs. Tremaine had reached Richard and found him, although not
seriously ill, low in health, and as the winter had set in with great
severity there was no prospect of moving him for at least a month.
Archie would remain with his mother to bring her and Richard home
when the latter was able to travel, but Colonel Tremaine would
return to Harrowby within a few days, certainly before Christmas
eve.
This day was close at hand. Christmas means little, however, as a
festival, in time of war. Angela contrived to fill the stockings of the
negro children with apples and walnuts and molasses candy made in
the kitchen by Mummy Tulip, but otherwise there was no attempt at
festivity.
Some of the neighbors and friends had already lost brothers and
sons in the bloody battles of the summer, and the rest were too
much concerned for the fate of their best beloved to attempt any
merrymaking.
Mrs. Charteris, whose heart was as good as her tongue was active,
had taken in a family of refugees which included five children, and
as she assumed the duties of doctor, nurse, and governess, her
hands were full, and she scarcely had time even to revile Mr. Brand,
who showed no signs of taking up arms for his country.
The weather, which up to that time had been singularly mild and
beautiful, suddenly grew gray and stormy and bitterly cold. No guest
had passed the doors of Harrowby since Colonel Tremaine left. It
was now the day before Christmas, and all day long Angela had
anxiously watched for Colonel Tremaine’s arrival.
About five o’clock, when it was already dark, and earth and sky and
river were all an icy and forbidding gray, Angela stood by the hall fire
with Lyddon, who had just come in from his afternoon tramp.
“I do so hope,” Angela said, “that Uncle Tremaine will get here
before it snows. Mammy Tulip says that she feels it in her bones that
snow will fall deep and everything will be frozen up. She thinks so
because she hears the owls hooting at night or something of the
sort.”
“I think so,” replied Lyddon, “because the wind is from the northwest
and the clouds have hung heavy all day.”
“How different it is,” cried Angela, “from last year!”
She came close to Lyddon and, as she often did in her earnestness,
laid her hand upon his arm and looked with dark and bewildered
eyes into his face.
“Last year,” she continued, “all was peace; this year all is war. Not
only everywhere, but here in my heart. It seems to me as if I were
at war with everyone in this house except you.”
“Poor child!” was all Lyddon could reply.
Angela drew back on the other side of the hearth and said: “But I
want to be at peace. I would like to be at peace with Uncle Tremaine
and Aunt Sophia—I love them so much. Even Archie is changed
toward me, and that little insignificant George Charteris looks at me
with contempt when he takes off his hat to me. And do you
remember how pleased I was at the idea of Madame Isabey and
Madame Le Noir coming here? Well, Madame Le Noir is at war with
me.”
“Life is all a battle and a march,” was Lyddon’s answer.
He glanced at the dim and worn painting of Penelope and the suitors
over the fireplace. Here, indeed, was a Penelope, and Lyddon
considered she had narrowly missed having an unconscious suitor in
the person of Philip Isabey. Luckily he had gone away before the
impression made upon him by Angela had deepened and changed
the current of his being.
Lyddon looked critically at Angela. She was certainly growing very
pretty, with a kind of beauty captivating as it was irregular. She
would never be classed as a beauty, but was as charming as
Adrienne Le Noir was seductive.
While these thoughts flashed through Lyddon’s mind he glanced
toward the western window and saw in the gloom of the wintry
evening the Harrowby carriage coming down the cedar lane.
“There’s Colonel Tremaine,” he said.
Angela’s thoughts were suddenly diverted into practical channels. “I
must have Uncle Tremaine’s fire lighted at once!” she cried, and,
stepping out upon the back porch, she rang the bell five times,
which was supposed to summon Tasso, but, after ringing in turn for
Mirandy and Jim Henry, finally succeeded in getting both of them,
who proceeded to hunt the place for Tasso instead of lighting the
fire themselves.
Meanwhile the carriage was at the door, and Angela, snatching up
her crimson mantle and throwing it over her fair head, ran down the
steps and herself opened the carriage door.
Out stepped Colonel Tremaine and kissed her affectionately. But
there was another person within the carriage—a man, pale and worn
and haggard, with a leg and an arm bound up. It was Philip Isabey.
The shock of seeing him was shown in Angela’s expressive face.
Instead of the warm and ready greeting which a guest usually
receives, she stood at the carriage door, her mantle dropping off her
shoulders, looking at Isabey with eyes which had in them something
both of fear and of delight. She felt more emotion at this sudden
apparition of him than she had ever felt at seeing anyone in her life
before. And with it an instinctive dread of being thrown with him
again instantly sprang into life.
Isabey, himself, had the disadvantage of being a close observer. He
had looked forward to this meeting not with fear but with pure
delight, and was prepared to watch how Angela greeted him; she
was so guileless that she was easily read by an experienced eye.
He held out his hand feebly and said in his old, pleasant, musical
voice: “How glad I am to see you again!”
Then Colonel Tremaine began explaining sonorously: “My dear
Angela, I had the extreme good fortune to come across Captain
Isabey when he most needed a friend. He had been severely
wounded and, though out of danger, was quite helpless, and lying
on the floor in a miserable shanty. I, of course, picked him up, bag
and baggage, and, instead of leaving him in the hospital at
Richmond, brought him back to Harrowby. You must do for him what
my dearest Sophie is doing for our beloved Richard—be nurse,
amanuensis, reader, and companion for him.”
“I will do all I can,” answered Angela, as if in a dream. And then
Lyddon appearing, he and Colonel Tremaine assisted Isabey up the
steps and into the hall.
It was not until he was seated in a great chair before the hall fire
and in the full glare of the blazing lightwood knots, that Angela saw
the havoc made in him by wounds and illness. He was very thin, and
his gray uniform was shabby and too large for his shrunken figure.
His dark complexion had grown pale, and there was a painful
thinness about his eyes and temples. His voice, however, had the
same cheerful, musical ring.
Isabey, in truth, was filled with rapture. By the hand of fate he had
been brought out of the direst misery into the companionship,
without seeking it, of this girl whose image he had been unable to
drive from his mind. His imagination had already been at work. He
knew perfectly well the conditions which prevailed at Harrowby. No
one would be there except Colonel Tremaine, Lyddon, Angela, and
himself. He would see Angela every day and all day long. She would
minister to him, and he might ask services of her inexpressibly sweet
to receive from her. And he would have long hours when he could
talk to her unheard by others. He had pictured to himself the
welcome which would shine in her face when she saw him, and the
divine pity with which she would listen to the story of his sufferings.
He did not fail to remind himself that Angela was not for him; she
was the wife of another man. But it is not in masculine nature to
refrain from inhaling the odor of a delicious flower which belongs to
another man or of breathing the air of heaven, although it may be in
the garden of another.
Any thought of betraying himself to Angela, or acquiring any
ascendency over her, was very far from Isabey’s mind, but when at
last they had met he had seen enough of agitation in her to know
that the meeting meant something to her as well as to him. And
being a very human man, he was penetrated with secret joy.
He saw still more plainly when she stood looking at him by the
firelight that she was reckoning up with a sympathy dangerously
near to tenderness all of his wounds, his pains, his fevers, all the
miseries which he had suffered. It seemed to Isabey then as if they
were but a small price to pay for a month in Angela’s society or even
for that one hour of peace and warmth and rest with Angela looking
down upon him with eyes of sweetest pity.
Colonel Tremaine, in response to Lyddon’s inquiries, began to tell
about Richard, and Angela, forcing herself to look away from Isabey,
listened to the story:
“We found our son recovering from the measles, a most grotesque
complaint for a soldier to have, but he had not taken proper care of
himself during the illness and was in a very low state when we
arrived. If he had been in fit condition to travel like our friend
Captain Isabey, we should have at once brought him to Harrowby,
but the snow is four feet deep in the upper country, and it is
impossible to think of moving Richard at this inclement season. His
mother, therefore, remains with him and Archibald also to minister to
them both. I felt it my duty to return to Harrowby. Your Aunt Sophia,
my dear, has sent you a letter, so has your brother Archibald, and
Richard sent you his best love and says you are to write to him as
well as to your Aunt Sophia.” And Colonel Tremaine handed two
letters to Angela.
“Our son had heard that Captain Isabey had been badly wounded,
and was somewhere in the neighborhood of Winchester. I at once
caused inquiries to be made and found that he was easily accessible
——”
“I beg your pardon,” interrupted Isabey with a wan smile, “coming to
fetch me meant traveling twenty-five miles over mountain roads in
December after a fortnight of snow.”
“At all events,” cried Colonel Tremaine expansively, “I was able to
find Captain Isabey, and, unlike our son, he was in a condition to be
moved, and the surgeon said if he could be made comfortable and
have rest and proper treatment for a couple of months, his right arm
and right leg would be as good as his left arm and left leg. So I and
my boy, Hector, wrapped him up in blankets, bundled him in the
carriage——”
“And drove most of the way himself,” said Isabey in a voice of
gratitude.
“And here he is, and I think, my dear Angela, if you could get him
some of your aunt’s excellent blackberry wine——”
Angela disappeared as soon as the word blackberry wine was
mentioned. In a few minutes she returned with a glass of it, piping
hot with spices in it. By that time she had recovered her composure
and was the Angela of old.
“This,” she said, smiling as she handed the glass to Isabey, “is an
Elizabethan drink—one of what Mr. Lyddon calls his formulas. In the
Elizabethan days, you know, people made wine out of everything.”
“And very good wine, too,” responded Isabey. “Better, no doubt, than
the doctored stuff of the post-Elizabethan days.”
He took the glass from Angela’s hand and drank the mulled wine,
warm and comforting. The wine and the fire brought the color into
his pale face and warmth into his chilled body. Angela, leaning her
elbow upon the mantle, said meditatively and with the air of the
chatelaine of Harrowby: “What would be the best room for Captain
Isabey?”
“Richard’s room,” suggested Lyddon. “It’s on the same level with the
study.”
“Capital!” exclaimed Colonel Tremaine.
“I think so,” said Angela, “and I shall go now and have it prepared.”
She went out, and in half an hour Mammy Tulip came into the hall
and delivered this message to Isabey:
“Miss Angela, she sent her bes’ ’spects an’ say Marse Richard’s room
is ready fur you, an’ I’se gwine ondress you an’ put you to baid.”
Colonel Tremaine looked much shocked. “That, Tulip,” he said
severely, “will be Tasso’s duty, who in the absence of Peter in
attendance upon his young master has charge of that room.”
Mammy Tulip received this emendation with undisguised contempt.
“Tasso, he good ’nuff fur well folks, but Cap’n Isabey, he’s wounded
and distrusted an’ I ain’t gwine let dat fool nigger ondress a sick
man.” And then to Isabey, “Come ’long, honey, an’ le’ me do fur you
jes’ what I do fur dem boys.”
Lyddon had seen this cool defiance of master and mistress every day
of the twelve years he had spent at Harrowby, but was still surprised
at it.
However, Isabey with the weakness of illness felt a placid pleasure in
yielding himself to Mammy Tulip’s motherly care, and willingly
allowed her to “hyst” him up as she expressed it, and leaning upon
her stout arm with Lyddon on the other side, Colonel Tremaine
walking behind, and Tasso, Jim Henry, Mirandy, and several of their
coadjutors bringing up the rear, the procession moved toward
Richard’s room.
One charm no room at Harrowby could ever lack—a roaring wood
fire. It had already taken the chill off the unused room, and to
Isabey the glow, the warmth, the great soft feather bed with its
snowy linen, was a little glimpse of paradise. And Angela moving
softly about and concerned for his comfort was the sweetest part of
the dream.
A round table was drawn up to an armchair in front of the fireplace,
and on it were quilled pens, cut by Lyddon, and red ink made from
the sumac berries, and the coarse writing paper which was the best
to be had in the Confederacy; and there were also some books. One
rapid glance showed Isabey that they were the books he liked;
Angela remembered all his tastes.
“Here,” she said, “you will have your supper, and then,” she added
with perfect simplicity, “Mammy Tulip will put you to bed.”
“And,” continued Mammy Tulip as she settled Isabey comfortably in
the chair with pillows, “I gwine to hab a big washtub brought in
heah an’ a kittle of b’iling water an’ I gwine gib you a nice hot bath
wid plenty ob soap an’ towels.” At which Isabey laughed faintly and
Lyddon grinned, much to the amazement of Angela and Colonel
Tremaine, who were accustomed to Mammy Tulip’s ministrations.
Isabey did not see Angela any more that night, and did not in truth
feel able to stand further excitement.
Mummy Tulip was as good as her word, and took entire charge of
him, and when she had given him his supper and had bathed him in
the big washtub as she had threatened, and had covered him up in
the great soft bed, Isabey felt that most exquisite of all bodily
sensations, release from pain. He had not slept an unbroken night
through since his leg and arm had been torn by a shell, but by the
time he realized his delicious well-being, sleep came upon him. Nor
did he open his eyes again until next morning. The fire was again
dancing in the chimney and Mammy Tulip was standing by his
bedside and holding a cup of something hot.
“It sutney is Gord’s mercy,” she said to him, “dat you an’ ole Marse
git heah lars’ night. De snow begin fallin’ a’ter sundown an’ ain’ stop
one single minit sence. De boys had to shovel a path in de snow so
ter git f’om de kitchen to de house, an’ dey had to breck de ice in de
waterin’ troughs fur de ho’ses an’ cows an’ sich.”
Isabey felt if anything an increase in his ease of body and mind at
what Mammy Tulip told him. There was something ineffably
seductive in the thought that he was, as it were, shut in from the
whole world by the rampart of snow and ice. That he could lie in the
soft bed and rise when he chose, and be washed and dressed like an
infant, and take that short and easy journey into the study where he
would find the companionship of books and Lyddon’s strong talk and
Colonel Tremaine’s warm courtesy and best of all—Angela.
For many months he had marched and fought and starved by day
and night. In summer heats, in autumn’s drenching rains and chilling
nights he had ridden and tramped through mud and latterly through
snow, and had known hunger and sleeplessness and, with all,
incessant fighting. Then had come a day of battle when almost the
last shot that was fired had nearly torn him to pieces. Following had
come a time of fearful suffering in a wretched shanty, where all that
could be done for him was an occasional hurried dressing of his
wounds by a surgeon who had learned to do without food or sleep.
Around Isabey had been others suffering as miserably as himself,
and his mind was distracted from his own tortures by watching with
pity others more tortured than himself.
Now, however, all this seemed a painful dream, and here he was in
warmth and peace and ease and paradise for a little time, and when
these should have done their work he would be ready once more for
hard campaigning.
CHAPTER XIV
SNOWBOUND

ISABEY remembered that it was Christmas morning. Snow had been


falling all the night through and lay white and deathlike over the
land.
The Christmas was unlike any Christmas which Harrowby had ever
known. There were neither wreaths nor decorations nor any
Christmas cheer. After breakfast, the negro children came into the
hall, where Angela distributed their Christmas stockings with such
homely sweets as she could provide, and the children went away
quietly.
The shadow of the war was upon them, too, and they understood
dimly in their childish way the vague unrest, the fears, the agitating
hopes of their elders, to whom the universe was changing daily and
who knew that things would never be as they had once been.
Angela was glad of the excuse of Isabey’s illness to keep the house
quiet. Colonel Tremaine retired to his library; the day to him was one
of bitter introspection. Lyddon, whom no weather could daunt, went
for a tramp in the snow. Angela busied herself with her household
affairs and then wrote a letter to Neville and afterwards to Mrs.
Tremaine, Richard, and Archie. It was the first time in her short life
she had been separated from them all on Christmas day.
It was twelve o’clock before Isabey was dressed and helped into the
study. There he found Angela sitting in a low chair reading. With
Mammy Tulip’s help, she made him comfortable on the old leather
sofa drawn close to the glowing fire. Hector, having cheerfully
permitted Mammy Tulip to perform all the services which Isabey’s
disability required, was on the spot to assume the direction of things
and to compare the campaign of Joshua round the walls of Jericho
with General Scott’s entrance into the City of Mexico.
He was, however, rudely cut short by Mammy Tulip hustling him out
of the way while she brought Isabey the inevitable “something hot.”
Hector retired with Mammy Tulip to have it out on the back porch,
and Angela and Isabey were left alone together.
“Mr. Lyddon will have George Charteris in the dining room every
morning after this,” she said. “This is to be your sitting room and you
are to send everybody out of it when you feel like it; Uncle
Tremaine, Mr. Lyddon, and me.”
“I shan’t send you away,” said Isabey in a low voice and quite
involuntarily. Angela blushed deeply.
She rose and went to the window through which was seen a world
all white under a menacing leaden sky. Even the river was covered
with snow and its voice was frozen.
“I never mind being snowbound,” she said, coming back to the fire.
“It always seems to me as if I could think and read better in winter
than in summer.”
“And in summer you enjoy and feel. Is it not like that?” asked
Isabey.
“Yes,” replied Angela, smiling. “When I was a little girl and Mr.
Lyddon would talk to me about Nature, I thought Nature was a great
goddess and was smiling in the summer when the sun shone and
the birds chirped, and in the autumn, when everything was dull and
gray and quiet, that the goddess was in the sulks. Then in winter
when the snow and ice came I thought Nature was in a bad humor
and had quarreled with her lover, the sun. What strange notions
children have!”
“And what a strange, poetic little child you must have been!”
“All real children are strange and poetic, I think; but, you see, not
many small girls are taught by a man like Mr. Lyddon. Now tell me
what happened to you when you were wounded.”
Isabey sighed. “When I’m stronger,” he said. “But now I want to put
it all away from me for a little while. I mean to give myself a whole
month of peace.”
“The doctors said two months.”
“The doctors always say two months when one month will do. Then
I shall be ready to go again. A soldier’s life is not all hardship. War is
the game of the gods.” After a moment he added in a perfectly
conventional tone: “I hope you hear good news from Captain
Tremaine?”
“It’s good news that he’s well,” replied Angela. “I hear from him
irregularly. I should have been with him long ago if he could have
had me, but he’s out in the far West, where there are no railroads or
stages or anything. I believe,” she added, the flush, which had died
from her face, returning quickly, “the very people for whom Neville
sacrificed everything don’t trust him. It’s because they don’t know
him. They only know that he is a Southern man in the Northern
Army. I feel so sorry for Neville and so indignant for him that I could
weep with grief and anger.”
“It’s also very hard for you,” said Isabey, gently.
“Yes, very, but what I endure is only a trifle compared with what
Neville has to suffer. You know he had great ambitions and he’s a
fine officer, everyone says that, and now all is forgotten and he has
no chance. But I ought not to inflict all of my burdens and vexations
upon you. Shall I read to you a little?”
“With pleasure,” answered Isabey.
Angela went to the bookcase and brought back several volumes.
“These,” she said with authority, “aren’t the books which you
particularly like, but the books which Mr. Lyddon says are soothing.
They’re all poetry books. Poetry, you know, calms and makes one
forget this workaday world.”
Isabey picked up a volume of “Childe Harold.” “I should like you to
read this to me. One likes the old familiar things when he is as weak
as I am. When I was in Europe I always carried ‘Childe Harold’ in my
pocket and read it among the very scenes which Byron describes.
You see, I was very young.”
“Youth may be wise. That’s just what I should do if I had seen Rome
and Venice and the Rhine.”
“Some day you will.”
Angela shook her head. “Neville isn’t fond of travel, and besides we
shall be poor because his father and mother will never give him
anything after this. He was to have had Harrowby, and we should
have settled down here as quietly as Uncle Tremaine and Aunt
Sophia. Richard, you know, meant to enter public life, and so the
place wasn’t so much to him, and he would have got, like Archie,
other property instead of Harrowby. Uncle Tremaine and Aunt Sophia
used to talk about it before them, but now all is changed. Neville will
have nothing, not an acre, not a stick, not a stone to call his own.”
“But he will have you,” replied Isabey, in a low voice and really
thinking aloud.
“And I shall have him,” responded Angela, quickly, and looking
steadily into Isabey’s eyes. She had uttered no word of reproach, but
Isabey after a moment said quietly:
“You must not be offended with me now for anything I say. I’m so
weak in body that it affects my will. I often found myself when I was
lying on the floor of that wretched hut asking the doctor for things
which I knew in advance he could not have supplied to save his life.
Be patient with a man who doesn’t know very well how to bear pain
of any sort.”
What woman could resist that? Angela said nothing, but her eyes
spoke forgiveness.
“He lay watching Angela with her quick-changing
expression.”
Then she opened the book and began to read. Her reading was
good and her understanding of the lines perfect. Isabey knew them
well, and their far-off, half-forgotten music fell softly upon his spirit.
He lay watching Angela with her quick-changing expression, her
easy and graceful attitude. It was all so sweetly, divinely peaceful,
and then before he knew it his eyes closed and he slept.
Angela read on, the music of her voice filling the low, small room.
She did not put down the book until Isabey slept soundly. Then she
watched him with her heart in her eyes.
If he had returned well and strong and full of the charm, the grace,
the captivations, the splendid accomplishments which had so dazzled
her at their first meeting, she would have been on her guard. But
who need be on her guard, she asked herself, with a wounded
soldier, a man as helpless as a child, and who was entitled to have
all things made soft and easy for him? And how ashy white he
looked, the whiter from the blackness of his hair!
In his sleep he moved his right arm and groaned without waking.
Angela rose and, changing the position of his arm a little, Isabey
moaned no more. The silence in the room was broken only by his
light breathing and the occasional dropping of a coal upon the
ashes. Without was that deep and dreamlike silence of
overwhelming snow. It seemed to Angela as if not only the face of
the world but all the people in it had changed within the year.
The Christmas before she had never seen Isabey, but her mind
working on the problem as women’s minds work, it seemed to her us
if she had really known him ever since those days when as a little
girl she saw the pictures of him taken with Richard. Her childish
imagination had seized upon Isabey’s image with a sort of
foreknowledge; she had been in love with him before she ever saw
him.
When this thought occurred to her, she reasoned with herself coolly.
To be in love with a name, with a fanciful image even of a real man
was not love. She had been in love with Lara, with Childe Harold,
even some of those old Greek and Roman heroes whose names she
had spelled out painfully when she was a child at Lyddon’s knee.
However, one of these heroes—Isabey—had taken shape and had
come bodily before her, and deep down in her heart, this airy
romance, this thing of dreams had become something real and
menacing to her happiness.
As she sat before the fire thinking these thoughts, Isabey waked
without stirring. He had been dreaming of Angela and to find her
close to him, her delicate profile outlined against the dark, book-
covered walls, to hear the occasional rustle of her gown, and to
watch her dark, narrow-lidded eyes in the gleam from the firelight,
seemed to him a continuation of his soft and witching dream. He
observed that her air and expression had matured singularly since
he had first seen her, when the syringas bloomed, the lilacs were in
their glory, and the blue iris hid shyly under its polished leaves, but
outwardly Angela was not yet a woman any more than the little rose
bushes of last year’s planting were rose trees now.
The silence, the warmth, the sweetness seemed to enwrap Isabey,
and without was that white and frozen world which made each
homestead a solitude. He lay thus for half an hour furtively watching
Angela. Then she turned toward him and met his dark eyes.
“I thought you were asleep,” she said, stepping toward him.
“I was asleep,” he replied, smiling, “and dreamed.”
“Do you remember it is Christmas day?” she asked, arranging his
pillows for him.
“I believe I knew it, but I have not exerted myself to think since I
have been under this roof. Everything is too deliciously sweet.”
“It is the strangest Christmas,” said Angela, returning to her low
chair. “Everything as quiet as death, not a sound in the house. I
filled the stockings of all the little negro children with apples and
nuts and molasses candy and gave them out early this morning. But
I made them keep quiet for fear of waking you. They were quiet
enough; something odd seems to have come over the negroes.”
“I should think so. With their ignorance of events and inability to
read and knowing neither geography nor history, don’t you suppose
they must be secret excited and bewildered by this war, in which
they have so huge a stake?”
“So Mr. Lyddon says. Every one of them is different, it seems to me,
since the war broke out, even Mammy Tulip and Uncle Hector. I
don’t mean that they are not just as faithful, but they listen to us
when we talk, and watch us, and I think repeat to each other what
we say. I wonder how I shall feel when I go North to Neville and
shan’t have any black people to wait upon me.”
“You will feel very queer, I dare say. I never grew accustomed to
being waited upon by white men all the time I was abroad. It is true
that I had my own boy with me, but I often felt a yearning for the
kindly negro faces, and longed to hear them laugh when they were
spoken to.”
While Angela and Isabey were talking, Colonel Tremaine came in. He
had taken advantage of Mrs. Tremaine’s absence to array himself in
a suit of before-the-war clothes, and was feeling much more at ease
in them than in homespun, and so expressed himself.
“Mrs. Tremaine’s wishes, my dear Captain Isabey, are paramount in
this house, and especially with me, and have been from the day that
I determined to ask her to become mine. She makes it somewhat a
point of conscience that I shall wear a suit of homespun, woven and
spun on the estate, and made by Mrs. Tremaine herself with the
assistance of her woman, Tulip. But I frankly confess that I feel more
comfortable in the clothes made by my Baltimore tailor. In other
respects, I submit cheerfully to the privations of the war. I have no
longer any objection to tallow candles, or to blackberry wine, or to
potato coffee sweetened with honey, or even to being shaved with
soft soap made by Tulip and of the color and consistency of mud and
molasses and presented by Hector in a gourd. And I can offer you
some apple brandy manufactured last summer in the Harrowby
kitchen. It is better than the alleged French brandy which I bought
from Captain Ross, the blockade-runner. I accused him of having
watered it. This he strenuously denied, but it appears he had diluted
it on the voyage and had inadvertently used salt water, and if you
will believe me, the scoundrel swore to my face that he had not
mixed any ingredients with the brandy, although it was as salt as
Lot’s wife. Running the blockade appears to make great liars of all
connected with the trade.”
Isabey duly sympathized with Colonel Tremaine’s grievances over the
salt-watered brandy, and the Colonel continued:
“In many ways we still enjoy the comforts to which we are
accustomed. The land brings forth fruitfully. The hens, ducks, and
turkeys seem to vie with each other in producing a multitude of
eggs. The fish still run in the river, and the oysters have not so far
concerned themselves with States’ rights, so at least we shall not
starve while you are with us.”
Isabey replied with truth that in lowland Virginia one might live like a
lord as long as the sun rose and the rivers ran.
At three o’clock the Christmas dinner was served, and around the
great mahogany table gathered a group smaller than it had ever
held before—Colonel Tremaine, Lyddon, Angela, and Isabey for a
part of the time. The dinner was rich in oysters, fishes, meats, and
vegetables, but deficient in sweets. When, according to the old
custom, the cloth was removed and the decanters on coasters were
sent around the table, Colonel Tremaine proposed the Christmas
toast to “our absent ones—the lady who reigns over this mansion
and also over the heart of its master, to its sons—” here he paused.
Angela said in a quick, tremulous voice, “Neville, Richard, and
Archie.”
Colonel Tremaine’s face darkened. The mention of his traitor son, as
he regarded Neville, was always painful to him, but he did not refuse
to drink the toast.
When the dinner was over the short wintry afternoon was closing in.
Snow was again falling heavily in a world already wrapped in
whiteness and silence. There were no sounds of merrymaking from
the negro quarters. All seemed to share the mood of tenseness and
somber expectation.
Colonel Tremaine was visibly depressed. It was the first Christmas he
had spent in forty years apart from Mrs. Tremaine and he felt it
deeply.
As the twilight closed in, Angela, wrapped in her red mantle, with
the hood over her head, went out into a misty world of snow and
faint moonshine, which penetrated a break in the overhanging
clouds. A pathway had been cut through the snow to the garden
gate and thence down the main walk to the old brick wall at the end.
Angela began to pace up and down her favorite walk. Her sense of
aloneness and aloofness was complete. The swirling white eddies
shut everything from her except the bare shrubs in the garden
standing like ghosts in the faint spectral glare of the moon on a
snowy night.
She began to question herself. Would she, if she were entirely free
to act, go at once to Neville? She answered her own question and
satisfactorily. Certainly she would. Did she love Neville? Yes, just as
she had always done, from the time she was a little girl and never
felt so safe with anyone as when her tiny hand lay in Neville’s boyish
palm. Was she in love with him? Ah, no! And would she ever be? To
that, too, her heart gave no doubtful answer, but a strong negative.
She was never to have a dream of love, any of those soft illusions
which make a young girl’s heart tremble.
Then relentlessly she asked herself if she was in love with Isabey.
She stopped in her walk and looked about her with scared eyes, as if
love were a specter to affright her. She was enveloped in the misty
veil of the falling snow which eddied about her and which was
lighted by that ghostly and silvery sheen of the hobgoblin moon.
Did she not feel the color come to her face whenever she caught
Isabey’s eyes fixed upon her? Did not her heart beat at his
footsteps, and did not his mere presence electrify the atmosphere?
Then another question forced itself into her mind, like a dagger into
an open wound. Was Isabey in love with her?
She had never thought or even suspected such a thing until he had
returned, the pitiful wreck of his former self. But Angela being, like
all the rest of her sex, learned in the secrets of the heart, had found
out what Isabey in truth was too ill, too weak, to conceal—that she
was dear to him.
Had they met one week earlier!
“But then,” she replied to herself, “it would have made no difference;
I could not have refused to stand by Neville when all the world was
arrayed against him.”
Whatever she or Isabey might suffer, Neville’s heart should be at
peace. She would be to him so tender, so affectionate, so watchful
to please him, that he would never suspect she had not given him
her whole treasure. And, feeling this, she had an expansion of the
soul which seemed to raise her in her own esteem.
Why need she be on her guard against Isabey? He had suffered so
much. He was the object which most appeals to a woman’s heart—a
wounded soldier. He was so weak, so worn, that no woman on earth
could refuse him her pity. And of his integrity, his delicacy, she had
not the smallest doubt. It seemed to her then so easy to be loyal
both to the real and to the ideal.
She resumed her walk in the swirling snow. At the same moment
Isabey, lying on the couch in the study watching the pallid twilight of
the snowstorm without and the rosy glow of the fire within, was
asking himself some of the same questions which Angela put to
herself in the storm-swept garden.
Was he in love with this girl? Yes. And more, he loved her with all his
heart. She was already the wife of a man whom he admired and
honored; she was born among different surroundings from his own:
bred differently from any girl he had ever known; of different blood
and religion and customs to his own, and yet an unbreakable chain
had been forged between them.
The first circumstance of this was strange to him—Angela’s suddenly
putting her hand in his that summer day, now six months past. He
was accustomed to the French method of training girls, and here
was Angela, who enjoyed even greater freedom than was usually
accorded to those girls of colder climes than Louisiana. This wife of
barely twenty was trusted as if she were a woman of sixty, and
although this was new to Isabey, it touched and enlightened him.
In place of Angela’s inexperience he had a thorough knowledge of
the world; hence he did not adopt Angela’s innocent delusion that it
would be easy to reconcile the real and the ideal. But for her, he
would at some time or other have acquiesced in one of those
marriages which are arranged with a view to fitness in every respect
except the perfect union of hearts. Often this union came; Isabey
was by no means prepared to condemn those methods concerning
marriage which he had been accustomed to all his life. A
conventional marriage, however, no longer was possible for him, but
at least he could enjoy the month in paradise which had come to
him out of the blue.
The thought that he would be tended by Angela, that he would be
able to command, by the royal will of a wounded man, her sweet
presence, her soft voice in reading to him, her conversation, which
was full of archness and simplicity, captivated him. The delicious
glow which overspread his spirit extended to his body and gave him
an exquisite sense of ease and comfort. In that month which he
allowed himself he would become well acquainted with Angela’s
mind. He had taken but small interest in women’s minds before,
although he keenly appreciated their accomplishments. Angela had
few of these accomplishments, but as well expect accomplishments
of a wood nymph. The study of her intelligence, however, was like
exploring a beautiful pleasance where there were groves, gardens,
and crystal fountains. She was one of the few women he had ever
seen whom he felt convinced age could not wither nor custom stale.
He was so lost in his delicious reverie that he did not hear the quiet
opening of the door, and then Angela with her usually pale cheeks
scarlet with the tingling cold, her eyes sparkling, and the snowflakes
still lying on her red mantle, stood by him.
She shook the snow off the mantle and cried: “I had such an
exciting walk! It was only up and down the garden path from the
gate to the bench under the lilac bushes, but it seemed to me as if I
had never before seen the garden look quite as it did. You know,
there is a moon, although there is a snowstorm. That doesn’t
happen often. And then I had such strange thoughts!”
“Were they unhappy thoughts?” asked Isabey, turning his black eyes
upon her.
“N—o, not at all unhappy, but singular. You see, up to a year ago
nothing had ever happened to me, and now all things are
happening, all things are changing.”
Isabey rose weakly from the couch, and, taking Angela’s hand in his,
kissed it with the tenderest respect.
“I hope,” he said, “that all will work toward your happiness. I hope
some day you will be happy with Neville Tremaine, but you can
afford to be a little kind to me.”
“Yes,” replied Angela, looking into his face quite calmly. “I can afford
to be kind to you. One of the things which came to me just now in
the garden was that as soon as Neville and I are together I must do
everything I can for his happiness. You see, he has always done
everything for me, and I’m afraid I haven’t given much thought to
doing anything for him. But now you may depend upon it I shall
really study Neville’s happiness; I shall be as generous as he is.”
“You have already been very generous. You married him when all
the world had turned against him.”
“Then I shouldn’t be generous halfway. I ought to be with him and
make him happy.”
She sat down in the low chair in which she had read to him. It
seemed to her if Isabey and she had spent hours in explanations
they could not have understood each other better.
So thought Isabey. Angela could never be his, but at least he had
found that jewel which all men seek and few discover—that other
half of his being, the woman who perfectly understood him. He
remembered that the hearts of men and women are like the cello
and the violin—both are required to form the perfect strain of music.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like