Arduino Cookbook

Overview

Create your own toys, remote controllers, alarms, detectors, robots, and many other projects with the Arduino device. This simple microcontroller board lets artists and designers build a variety of amazing objects and prototypes that interact with the physical world. With this cookbook you can dive right in and experiment with more than a hundred tips and techniques, no matter what your skill level is.

Updated for the Arduino 1.0 release, recipes in the second edition provide ...

See more details below
Paperback
$26.01
BN.com price
(Save 42%)$44.99 List Price
Other sellers (Paperback)
  • All (16) from $15.56   
  • New (5) from $26.49   
  • Used (11) from $15.56   
Sending request ...

Overview

Create your own toys, remote controllers, alarms, detectors, robots, and many other projects with the Arduino device. This simple microcontroller board lets artists and designers build a variety of amazing objects and prototypes that interact with the physical world. With this cookbook you can dive right in and experiment with more than a hundred tips and techniques, no matter what your skill level is.

Updated for the Arduino 1.0 release, recipes in the second edition provide solutions for most common problems and questions Arduino users have, including everything from programming fundamentals to working with sensors, motors, lights, and sound, or communicating over wired and wireless networks. You'll find the examples and advice you need to begin, expand, and enhance your projects right away.

  • Get to know the Arduino development environment
  • Understand the core elements of the Arduino programming language
  • Use common output devices for light, motion, and sound
  • Interact with almost any device that has a remote control
  • Learn techniques for handling time delays and time measurement
  • Use simple ways to transfer digital information from sensors to the Arduino device
  • Create complex projects that incorporate shields and external modules
  • Use and modify existing Arduino libraries, and learn how to create your own

Michael Margolis is a technologist in the field of real time computing with expertise in developing and delivering hardware and software for interacting with the environment. He has over 30 years of experience in a wide range of relevant technologies, working with Sony, Microsoft, Lucent/Bell Labs, and most recently as Chief Technical Officer with Avaya.

Read More Show Less

Product Details

  • ISBN-13: 9780596802479
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 4/1/2011
  • Edition number: 1
  • Pages: 662
  • Sales rank: 1,025,050
  • Product dimensions: 6.80 (w) x 9.10 (h) x 1.50 (d)

Meet the Author

Michael Margolis is a technologist in the field of real time computing with expertise in developing and delivering hardware and software for interacting with the environment. He has over 30 years of experience in a wide range of relevant technologies, working with Sony, Microsoft, Lucent/Bell Labs, and most recently as Chief Technical Officer with Avaya.

Read More Show Less

Table of Contents

Preface; Who This Book Is For; How This Book Is Organized; What Was Left Out; Code Style (About the Code); Arduino Platform Release Notes; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Chapter 1: Getting Started; 1.1 Introduction; 1.2 Installing the Integrated Development Environment (IDE); 1.3 Setting Up the Arduino Board; 1.4 Using the Integrated Development Environment (IDE) to Prepare an Arduino Sketch; 1.5 Uploading and Running the Blink Sketch; 1.6 Creating and Saving a Sketch; 1.7 Using Arduino; Chapter 2: Making the Sketch Do Your Bidding; 2.1 Introduction; 2.2 Structuring an Arduino Program; 2.3 Using Simple Primitive Types (Variables); 2.4 Using Floating-Point Numbers; 2.5 Working with Groups of Values; 2.6 Using Arduino String Functionality; 2.7 Using C Character Strings; 2.8 Splitting Comma-Separated Text into Groups; 2.9 Converting a Number to a String; 2.10 Converting a String to a Number; 2.11 Structuring Your Code into Functional Blocks; 2.12 Returning More Than One Value from a Function; 2.13 Taking Actions Based on Conditions; 2.14 Repeating a Sequence of Statements; 2.15 Repeating Statements with a Counter; 2.16 Breaking Out of Loops; 2.17 Taking a Variety of Actions Based on a Single Variable; 2.18 Comparing Character and Numeric Values; 2.19 Comparing Strings; 2.20 Performing Logical Comparisons; 2.21 Performing Bitwise Operations; 2.22 Combining Operations and Assignment; Chapter 3: Using Mathematical Operators; 3.1 Introduction; 3.2 Adding, Subtracting, Multiplying, and Dividing; 3.3 Incrementing and Decrementing Values; 3.4 Finding the Remainder After Dividing Two Values; 3.5 Determining the Absolute Value; 3.6 Constraining a Number to a Range of Values; 3.7 Finding the Minimum or Maximum of Some Values; 3.8 Raising a Number to a Power; 3.9 Taking the Square Root; 3.10 Rounding Floating-Point Numbers Up and Down; 3.11 Using Trigonometric Functions; 3.12 Generating Random Numbers; 3.13 Setting and Reading Bits; 3.14 Shifting Bits; 3.15 Extracting High and Low Bytes in an int or long; 3.16 Forming an int or long from High and Low Bytes; Chapter 4: Serial Communications; 4.1 Introduction; 4.2 Sending Debug Information from Arduino to Your Computer; 4.3 Sending Formatted Text and Numeric Data from Arduino; 4.4 Receiving Serial Data in Arduino; 4.5 Sending Multiple Text Fields from Arduino in a Single Message; 4.6 Receiving Multiple Text Fields in a Single Message in Arduino; 4.7 Sending Binary Data from Arduino; 4.8 Receiving Binary Data from Arduino on a Computer; 4.9 Sending Binary Values from Processing to Arduino; 4.10 Sending the Value of Multiple Arduino Pins; 4.11 How to Move the Mouse Cursor on a PC or Mac; 4.12 Controlling Google Earth Using Arduino; 4.13 Logging Arduino Data to a File on Your Computer; 4.14 Sending Data to Two Serial Devices at the Same Time; 4.15 Receiving Serial Data from Two Devices at the Same Time; 4.16 Setting Up Processing on Your Computer to Send and Receive Serial Data; Chapter 5: Simple Digital and Analog Input; 5.1 Introduction; 5.2 Using a Switch; 5.3 Using a Switch Without External Resistors; 5.4 Reliably Detecting the Closing of a Switch; 5.5 Determining How Long a Switch Is Pressed; 5.6 Reading a Keypad; 5.7 Reading Analog Values; 5.8 Changing the Range of Values; 5.9 Reading More Than Six Analog Inputs; 5.10 Displaying Voltages Up to 5V; 5.11 Responding to Changes in Voltage; 5.12 Measuring Voltages More Than 5V (Voltage Dividers); Chapter 6: Getting Input from Sensors; 6.1 Introduction; 6.2 Detecting Movement; 6.3 Detecting Light; 6.4 Detecting Motion (Integrating Passive Infrared Detectors); 6.5 Measuring Distance; 6.6 Measuring Distance Accurately; 6.7 Detecting Vibration; 6.8 Detecting Sound; 6.9 Measuring Temperature; 6.10 Reading RFID Tags; 6.11 Tracking the Movement of a Dial; 6.12 Tracking the Movement of More Than One Rotary Encoder; 6.13 Tracking the Movement of a Dial in a Busy Sketch; 6.14 Using a Mouse; 6.15 Getting Location from a GPS; 6.16 Detecting Rotation Using a Gyroscope; 6.17 Detecting Direction; 6.18 Getting Input from a Game Control Pad (PlayStation); 6.19 Reading Acceleration; Chapter 7: Visual Output; 7.1 Introduction; 7.2 Connecting and Using LEDs; 7.3 Adjusting the Brightness of an LED; 7.4 Driving High-Power LEDs; 7.5 Adjusting the Color of an LED; 7.6 Sequencing Multiple LEDs: Creating a Bar Graph; 7.7 Sequencing Multiple LEDs: Making a Chase Sequence (Knight Rider); 7.8 Controlling an LED Matrix Using Multiplexing; 7.9 Displaying Images on an LED Matrix; 7.10 Controlling a Matrix of LEDs: Charlieplexing; 7.11 Driving a 7-Segment LED Display; 7.12 Driving Multidigit, 7-Segment LED Displays: Multiplexing; 7.13 Driving Multidigit,,,,,, 7-Segment LED Displays Using MAX7221 Shift Registers; 7.14 Controlling an Array of LEDs by Using MAX72xx Shift Registers; 7.15 Increasing the Number of Analog Outputs Using PWM Extender Chips (TLC5940); 7.16 Using an Analog Panel Meter As a Display; Chapter 8: Physical Output; 8.1 Introduction; 8.2 Controlling the Position of a Servo; 8.3 Controlling One or Two Servos with a Potentiometer or Sensor; 8.4 Controlling the Speed of Continuous Rotation Servos; 8.5 Controlling Servos from the Serial Port; 8.6 Driving a Brushless Motor (Using a Hobby Speed Controller); 8.7 Controlling Solenoids and Relays; 8.8 Making an Object Vibrate; 8.9 Driving a Brushed Motor Using a Transistor; 8.10 Controlling the Direction of a Brushed Motor with an H-Bridge; 8.11 Controlling the Direction and Speed of a Brushed Motor with an H-Bridge; 8.12 Using Sensors to Control the Direction and Speed of Brushed Motors (L293 H-Bridge); 8.13 Driving a Bipolar Stepper Motor; 8.14 Driving a Bipolar Stepper Motor (Using the EasyDriver Board); 8.15 Driving a Unipolar Stepper Motor (ULN2003A); Chapter 9: Audio Output; 9.1 Introduction; 9.2 Playing Tones; 9.3 Playing a Simple Melody; 9.4 Generating More Than One Simultaneous Tone; 9.5 Generating Audio Tones and Fading an LED; 9.6 Playing a WAV File; 9.7 Controlling MIDI; 9.8 Making an Audio Synthesizer; Chapter 10: Remotely Controlling External Devices; 10.1 Introduction; 10.2 Responding to an Infrared Remote Control; 10.3 Decoding Infrared Remote Control Signals; 10.4 Imitating Remote Control Signals; 10.5 Controlling a Digital Camera; 10.6 Controlling AC Devices by Hacking a Remote Controlled Switch; Chapter 11: Using Displays; 11.1 Introduction; 11.2 Connecting and Using a Text LCD Display; 11.3 Formatting Text; 11.4 Turning the Cursor and Display On or Off; 11.5 Scrolling Text; 11.6 Displaying Special Symbols; 11.7 Creating Custom Characters; 11.8 Displaying Symbols Larger Than a Single Character; 11.9 Displaying Pixels Smaller Than a Single Character; 11.10 Connecting and Using a Graphical LCD Display; 11.11 Creating Bitmaps for Use with a Graphical Display; 11.12 Displaying Text on a TV; Chapter 12: Using Time and Dates; 12.1 Introduction; 12.2 Creating Delays; 12.3 Using millis to Determine Duration; 12.4 More Precisely Measuring the Duration of a Pulse; 12.5 Using Arduino As a Clock; 12.6 Creating an Alarm to Periodically Call a Function; 12.7 Using a Real-Time Clock; Chapter 13: Communicating Using I2C and SPI; 13.1 Introduction; 13.2 Controlling an RGB LED Using the BlinkM Module; 13.3 Using the Wii Nunchuck Accelerometer; 13.4 Interfacing to an External Real-Time Clock; 13.5 Adding External EEPROM Memory; 13.6 Reading Temperature with a Digital Thermometer; 13.7 Driving Four 7-Segment LEDs Using Only Two Wires; 13.8 Integrating an I2C Port Expander; 13.9 Driving Multidigit, 7-Segment Displays Using SPI; 13.10 Communicating Between Two or More Arduino Boards; Chapter 14: Wireless Communication; 14.1 Introduction; 14.2 Sending Messages Using Low-Cost Wireless Modules; 14.3 Connecting Arduino to a ZigBee or 802.15.4 Network; 14.4 Sending a Message to a Particular XBee; 14.5 Sending Sensor Data Between XBees; 14.6 Activating an Actuator Connected to an XBee; Chapter 15: Ethernet and Networking; 15.1 Introduction; 15.2 Setting Up the Ethernet Shield; 15.3 Obtaining Your IP Address Automatically; 15.4 Resolving Hostnames to IP Addresses (DNS); 15.5 Requesting Data from a Web Server; 15.6 Requesting Data from a Web Server Using XML; 15.7 Setting Up an Arduino to Be a Web Server; 15.8 Handling Incoming Web Requests; 15.9 Handling Incoming Requests for Specific Pages; 15.10 Using HTML to Format Web Server Responses; 15.11 Serving Web Pages Using Forms (POST); 15.12 Serving Web Pages Containing Large Amounts of Data; 15.13 Sending Twitter Messages; 15.14 Sending and Receiving Simple Messages (UDP); 15.15 Getting the Time from an Internet Time Server; 15.16 Monitoring Pachube Feeds; 15.17 Sending Information to Pachube; Chapter 16: Using, Modifying, and Creating Libraries; 16.1 Introduction; 16.2 Using the Built-in Libraries; 16.3 Installing Third-Party Libraries; 16.4 Modifying a Library; 16.5 Creating Your Own Library; 16.6 Creating a Library That Uses Other Libraries; Chapter 17: Advanced Coding and Memory Handling; 17.1 Introduction; 17.2 Understanding the Arduino Build Process; 17.3 Determining the Amount of Free and Used RAM; 17.4 Storing and Retrieving Numeric Values in Program Memory; 17.5 Storing and Retrieving Strings in Program Memory; 17.6 Using #define and const Instead of Integers; 17.7 Using Conditional Compilations; Chapter 18: Using the Controller Chip Hardware; 18.1 Introduction; 18.2 Storing Data in Permanent EEPROM Memory; 18.3 Using Hardware Interrupts; 18.4 Setting Timer Duration; 18.5 Setting Timer Pulse Width and Duration; 18.6 Creating a Pulse Generator; 18.7 Changing a Timer’s PWM Frequency; 18.8 Counting Pulses; 18.9 Measuring Pulses More Accurately; 18.10 Measuring Analog Values Quickly; 18.11 Reducing Battery Drain; 18.12 Setting Digital Pins Quickly; 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; Using Schematic Diagrams and Data Sheets; How to Read a Data Sheet; Choosing and Using Transistors for Switching; 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; Tips on Troubleshooting Software Problems; Code That Won’t Compile; Code That Compiles but Does Not Work As Expected; Troubleshooting Interrelated Hardware/Software Problems; Tips on Troubleshooting Hardware Problems; Still Stuck?; Digital and Analog Pins; ASCII and Extended Character Sets; Colophon;

Michael Margolis is a technologist in the field of real time computing with expertise in developing and delivering hardware and software for interacting with the environment. He has over 30 years of experience in a wide range of relevant technologies, working with Sony, Microsoft, Lucent/Bell Labs, and most recently as Chief Technical Officer with Avaya.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 4 Customer Reviews
  • Anonymous

    Posted March 9, 2012

    Highly recommend

    There are items and figures that - up to this point - are better presented by a physical book. Content gets 5 stars. Readability of code on nook color gets 3 stars.

    If you have an arduino, this book is a must-have. I program microcontrollers for work and i still learned nice techniques from this book that simply hadn't occured to me.

    1 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted April 21, 2012

    I would like to write a review....

    ...but I can't. The NOOK for Mac app is worse than a beta version. Quite frankly it would be an insult to gamma. Perhaps they should work their way back from omega. That would give me hope for the eventual beta .

    0 out of 6 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted May 11, 2012

    No text was provided for this review.

  • Anonymous

    Posted March 24, 2013

    No text was provided for this review.

Sort by: Showing all of 4 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)