Copyright 2017 Yining Shi and Sagar Mohite. All rights reserved.
Published by Maker Media, Inc., 1700 Montgomery Street, Suite 240, San Francisco, CA 94111
Maker Media books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com.
Publisher: Roger Stewart
Editor: Patrick DiJusto
Copy Editor: Elizabeth Welch, Happenstance Type-O-Rama
Proofreader: Scout Festa, Happenstance Type-O-Rama
Interior Designer and Compositor: Maureen Forys, Happenstance Type-O-Rama
Cover Designer: Maureen Forys, Happenstance Type-O-Rama
Indexer: Valerie Perry, Happenstance Type-O-Rama
All the circuit and component diagrams in this book are created using Fritzing (http://fritzing.org/home).
August 2017: First Edition
Revision History for the First Edition
2017-08-28 First Release
See oreilly.com/catalog/errata.csp?isbn=9781680453867 for release details.
Make:, Maker Shed, and Maker Faire are registered trademarks of Maker Media, Inc. The Maker Media logo is a trademark of Maker Media, Inc. Jumpstarting the Arduino 101 and related trade dress are trademarks of Maker Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Maker Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
978-1-68045-386-7
Safari Books Online
Safari Books Online is an on-demand digital library that delivers expert content in both book and video form from the worlds leading authors in technology and business. Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training. Safari Books Online offers a range of plans and pricing for enterprise, government, education, and individuals. Members have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like OReilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more information about Safari Books Online, please visit us online.
How to Contact Us
Please address comments and questions to the publisher:
Maker Media
1700 Montgomery St.
Suite 240
San Francisco, CA 94111
You can send comments and questions to us by email at books@makermedia.com.
Maker Media unites, inspires, informs, and entertains a growing community of resourceful people who undertake amazing projects in their backyards, basements, and garages. Maker Media celebrates your right to tweak, hack, and bend any Technology to your will. The Maker Media audience continues to be a growing culture and community that believes in bettering ourselves, our environment, our educational systemour entire world. This is much more than an audience, its a worldwide movement that Maker Media is leading. We call it the Maker Movement.
To learn more about Make: visit us at makezine.com. You can learn more about the company at the following websites:
Maker Media: makermedia.com
Maker Faire: makerfaire.com
Maker Shed: makershed.com
Dedication
To my parents, for their endless support
Yining Shi
Acknowledgments
Id like to thank my co-author, Sagar Mohite, for spending numerous hours writing the book with me and for believing in me all the time Tom Igoe, for his guidance, super-helpful suggestions, and feedback editor Patrick DiJusto, for helping me and encouraging me throughout the whole process and copy editor Elizabeth Welch and designer Maureen Forys for doing such an amazing job.
Yining Shi
Its been a real pleasure working on this book, and I want to thank Yining Shi for inviting me to collaborate. I also want to thank my parents for their support and everyone who helped make this book a reality.
Sagar Mohite
Preface
Arduino has taken over the maker movement over the last decade as one of the most accessible hardware and software platforms for creatives and makers. Arduino 101 is one of the newest boards from Arduino. It combines the ease-of-use of boards like Arduino Uno with powerful features, such as Bluetooth, motion sensing, and gesture recognition.
Over the last two decades, the web has also evolved to be the most accessible and engaging form of media. In this book youll also explore the possibilities of creating web-based interfaces to communicate with Arduino 101 via the recently drafted Web Bluetooth API. Youll also learn how to use the accelerometer and gyroscope built into the 101, along with Intel Curies pattern matching engine, to train the board and build your own media player.
This hands-on introduction to Arduino 101, complete with source code and walkthroughs, will help you start prototyping your projects right away.
Using the Code Examples
The source code for all experiments in this book is included inline with explanations where necessary. Additionally, it is hosted on my GitHub account https://github.com/yininc10uf023/Jumpstarting-the-Arduino-101) and is distributed under the MIT License.
Chapter 1
What Is Arduino?
A rduino is an open source platform that enables creatives, artists, makers, and engineers to prototype interactive physical computing projects. The Arduino ecosystem can be broadly divided into two parts: Arduino boards and the Arduino software, or the integrated development environment (IDE).
Arduino closely incorporates the open source philosophy, which, broadly speaking, is all about making the source and the design documents of products free to use, share, and distribute under open licenses. The idea is to make knowledge more accessible and therefore encourage collaboration and exchange of ideas among people. Arduino has released all the original design files (EAGLE CAD) for the Arduino hardware under a Creative Commons Attribution Share-Alike license, which allows for both personal and commercial derivative works, as long as they credit Arduino and release their designs under the same license. The source code for the software is released under various GNU licenses.
Hardware
Many of you might already be familiar with an Arduino board. An Arduino board is a small computer that can be connected to various sensors like thermometers, accelerometers, and photoresistors to measure the world around us. It can also be programmed to control LEDs, as well as actuators like motors, to affect the world around us.
Next page