- Chapter 1 Getting Started
- Introduction
- Installing the Integrated Development Environment (IDE)
- Setting Up the Arduino Board
- Using the Integrated Development Environment (IDE) to Prepare an Arduino Sketch
- Uploading and Running the Blink Sketch
- Creating and Saving a Sketch
- Using Arduino
- Chapter 2 Making the Sketch Do Your Bidding
- Introduction
- Structuring an Arduino Program
- Using Simple Primitive Types (Variables)
- Using Floating-Point Numbers
- Working with Groups of Values
- Using Arduino String Functionality
- Using C Character Strings
- Splitting Comma-Separated Text into Groups
- Converting a Number to a String
- Converting a String to a Number
- Structuring Your Code into Functional Blocks
- Returning More Than One Value from a Function
- Taking Actions Based on Conditions
- Repeating a Sequence of Statements
- Repeating Statements with a Counter
- Breaking Out of Loops
- Taking a Variety of Actions Based on a Single Variable
- Comparing Character and Numeric Values
- Comparing Strings
- Performing Logical Comparisons
- Performing Bitwise Operations
- Combining Operations and Assignment
- Chapter 3 Using Mathematical Operators
- Introduction
- Adding, Subtracting, Multiplying, and Dividing
- Incrementing and Decrementing Values
- Finding the Remainder After Dividing Two Values
- Determining the Absolute Value
- Constraining a Number to a Range of Values
- Finding the Minimum or Maximum of Some Values
- Raising a Number to a Power
- Taking the Square Root
- Rounding Floating-Point Numbers Up and Down
- Using Trigonometric Functions
- Generating Random Numbers
- Setting and Reading Bits
- Shifting Bits
- Extracting High and Low Bytes in an int or long
- Forming an int or long from High and Low Bytes
- Chapter 4 Serial Communications
- Introduction
- Sending Debug Information from Arduino to Your Computer
- Sending Formatted Text and Numeric Data from Arduino
- Receiving Serial Data in Arduino
- Sending Multiple Text Fields from Arduino in a Single Message
- Receiving Multiple Text Fields in a Single Message in Arduino
- Sending Binary Data from Arduino
- Receiving Binary Data from Arduino on a Computer
- Sending Binary Values from Processing to Arduino
- Sending the Value of Multiple Arduino Pins
- How to Move the Mouse Cursor on a PC or Mac
- Controlling Google Earth Using Arduino
- Logging Arduino Data to a File on Your Computer
- Sending Data to Two Serial Devices at the Same Time
- Receiving Serial Data from Two Devices at the Same Time
- Setting Up Processing on Your Computer to Send and Receive Serial Data
- Chapter 5 Simple Digital and Analog Input
- Introduction
- Using a Switch
- Using a Switch Without External Resistors
- Reliably Detecting the Closing of a Switch
- Determining How Long a Switch Is Pressed
- Reading a Keypad
- Reading Analog Values
- Changing the Range of Values
- Reading More Than Six Analog Inputs
- Displaying Voltages Up to 5V
- Responding to Changes in Voltage
- Measuring Voltages More Than 5V (Voltage Dividers)
- Chapter 6 Getting Input from Sensors
- Introduction
- Detecting Movement
- Detecting Light
- Detecting Motion (Integrating Passive Infrared Detectors)
- Measuring Distance
- Measuring Distance Accurately
- Detecting Vibration
- Detecting Sound
- Measuring Temperature
- Reading RFID Tags
- Tracking the Movement of a Dial
- Tracking the Movement of More Than One Rotary Encoder
- Tracking the Movement of a Dial in a Busy Sketch
- Using a Mouse
- Getting Location from a GPS
- Detecting Rotation Using a Gyroscope
- Detecting Direction
- Getting Input from a Game Control Pad (PlayStation)
- Reading Acceleration
- Chapter 7 Visual Output
- Introduction
- Connecting and Using LEDs
- Adjusting the Brightness of an LED
- Driving High-Power LEDs
- Adjusting the Color of an LED
- Sequencing Multiple LEDs: Creating a Bar Graph
- Sequencing Multiple LEDs: Making a Chase Sequence (Knight Rider)
- Controlling an LED Matrix Using Multiplexing
- Displaying Images on an LED Matrix
- Controlling a Matrix of LEDs: Charlieplexing
- Driving a 7-Segment LED Display
- Driving Multidigit, 7-Segment LED Displays: Multiplexing
- Driving Multidigit, 7-Segment LED Displays Using MAX7221 Shift Registers
- Controlling an Array of LEDs by Using MAX72xx Shift Registers
- Increasing the Number of Analog Outputs Using PWM Extender Chips (TLC5940)
- Using an Analog Panel Meter As a Display
- Chapter 8 Physical Output
- Introduction
- Controlling the Position of a Servo
- Controlling One or Two Servos with a Potentiometer or Sensor
- Controlling the Speed of Continuous Rotation Servos
- Controlling Servos from the Serial Port
- Driving a Brushless Motor (Using a Hobby Speed Controller)
- Controlling Solenoids and Relays
- Making an Object Vibrate
- Driving a Brushed Motor Using a Transistor
- Controlling the Direction of a Brushed Motor with an H-Bridge
- Controlling the Direction and Speed of a Brushed Motor with an H-Bridge
- Using Sensors to Control the Direction and Speed of Brushed Motors (L293 H-Bridge)
- Driving a Bipolar Stepper Motor
- Driving a Bipolar Stepper Motor (Using the EasyDriver Board)
- Driving a Unipolar Stepper Motor (ULN2003A)
- Chapter 9 Audio Output
- Introduction
- Playing Tones
- Playing a Simple Melody
- Generating More Than One Simultaneous Tone
- Generating Audio Tones and Fading an LED
- Playing a WAV File
- Controlling MIDI
- Making an Audio Synthesizer
- Chapter 10 Remotely Controlling External Devices
- Introduction
- Responding to an Infrared Remote Control
- Decoding Infrared Remote Control Signals
- Imitating Remote Control Signals
- Controlling a Digital Camera
- Controlling AC Devices by Hacking a Remote Controlled Switch
- Chapter 11 Using Displays
- Introduction
- Connecting and Using a Text LCD Display
- Formatting Text
- Turning the Cursor and Display On or Off
- Scrolling Text
- Displaying Special Symbols
- Creating Custom Characters
- Displaying Symbols Larger Than a Single Character
- Displaying Pixels Smaller Than a Single Character
- Connecting and Using a Graphical LCD Display
- Creating Bitmaps for Use with a Graphical Display
- Displaying Text on a TV
- Chapter 12 Using Time and Dates
- Introduction
- Creating Delays
- Using millis to Determine Duration
- More Precisely Measuring the Duration of a Pulse
- Using Arduino As a Clock
- Creating an Alarm to Periodically Call a Function
- Using a Real-Time Clock
- Chapter 13 Communicating Using I2C and SPI
- Introduction
- Controlling an RGB LED Using the BlinkM Module
- Using the WiiNunchuck Accelerometer
- Interfacing to an External Real-Time Clock
- Adding External EEPROM Memory
- Reading Temperature with a Digital Thermometer
- Driving Four 7-Segment LEDs Using Only Two Wires
- Integrating an I2C Port Expander
- Driving Multidigit, 7-Segment Displays Using SPI
- Communicating Between Two or More Arduino Boards
- Chapter 14 Wireless Communication
- Introduction
- Sending Messages Using Low-Cost Wireless Modules
- Connecting Arduino to a ZigBee or 802.15.4 Network
- Sending a Message to a Particular XBee
- Sending Sensor Data Between XBees
- Activating an Actuator Connected to an XBee
- Chapter 15 Ethernet and Networking
- Introduction
- Setting Up the Ethernet Shield
- Obtaining Your IP Address Automatically
- Resolving Hostnames to IP Addresses (DNS)
- Requesting Data from a Web Server
- Requesting Data from a Web Server Using XML
- Setting Up an Arduino to Be a Web Server
- Handling Incoming Web Requests
- Handling Incoming Requests for Specific Pages
- Using HTML to Format Web Server Responses
- Serving Web Pages Using Forms (POST)
- Serving Web Pages Containing Large Amounts of Data
- Sending Twitter Messages
- Sending and Receiving Simple Messages (UDP)
- Getting the Time from an Internet Time Server
- Monitoring Pachube Feeds
- Sending Information to Pachube
- Chapter 16 Using, Modifying, and Creating Libraries
- Introduction
- Using the Built-in Libraries
- Installing Third-Party Libraries
- Modifying a Library
- Creating Your Own Library
- Creating a Library That Uses Other Libraries
- Chapter 17 Advanced Coding and Memory Handling
- Introduction
- Understanding the Arduino Build Process
- Determining the Amount of Free and Used RAM
- Storing and Retrieving Numeric Values in Program Memory
- Storing and Retrieving Strings in Program Memory
- Using #define and const Instead of Integers
- Using Conditional Compilations
- Chapter 18 Using the Controller Chip Hardware
- Introduction
- Storing Data in Permanent EEPROM Memory
- Using Hardware Interrupts
- Setting Timer Duration
- Setting Timer Pulse Width and Duration
- Creating a Pulse Generator
- Changing a Timer’s PWM Frequency
- Counting Pulses
- Measuring Pulses More Accurately
- Measuring Analog Values Quickly
- Reducing Battery Drain
- Setting Digital Pins Quickly
- Appendix Electronic Components
- Capacitor
- Diode
- Integrated Circuit
- Keypad
- LED
- Motor (DC)
- Optocoupler
- Photocell (Photoresistor)
- Piezo
- Pot (Potentiometer)
- Relay
- Resistor
- Solenoid
- Speaker
- Stepper Motor
- Switch
- Transistor
- See Also
- Appendix Using Schematic Diagrams and Data Sheets
- How to Read a Data Sheet
- Choosing and Using Transistors for Switching
- Appendix Building and Connecting the Circuit
- Using a Breadboard
- Connecting and Using External Power Supplies and Batteries
- Using Capacitors for Decoupling
- Using Snubber Diodes with Inductive Loads
- Working with AC Line Voltages
- Appendix Tips on Troubleshooting Software Problems
- Code That Won’t Compile
- Code That Compiles but Does Not Work As Expected
- Troubleshooting Interrelated Hardware/Software Problems
- Appendix Tips on Troubleshooting Hardware Problems
- Still Stuck?
- Appendix Digital and Analog Pins
- Appendix ASCII and Extended Character Sets
Colophon