Arduino Sketches. Langbridge James A.

Читать онлайн.
Название Arduino Sketches
Автор произведения Langbridge James A.
Жанр Зарубежная образовательная литература
Серия
Издательство Зарубежная образовательная литература
Год выпуска 0
isbn 9781118919699



Скачать книгу

Image

      © iStock.com/johnbloor

      Acknowledgments

      Writing a book is a huge project. When I was at school, I used to shudder at the thought of writing 1,000 words for an essay, and I was alone to do it. This book is, of course, much longer, and I enjoyed every minute of it, thanks to the team of professionals who helped me every step of the way. Take a quick look at the people involved in this project, and you will soon see what I'm talking about.

      I can't thank everyone involved personally; there are just too many people, but there are a few names that I will never forget. My thanks go out to Christina Haviland, my project editor. When I knew that I would be working with her again, I was thrilled. She actually managed to put up with me for the entire duration and didn't even shout at me when I was late, despite the fact that some of the chapters were very, very late. I was also thrilled to know that I'd be working with San Dee Phillips, my copy editor. The job they did transforming raw data coming out of my brain into something readable is outstanding. Then there is Scott Fitzgerald, my technical editor, who made sure that I didn't make any mistakes. Believe me, nothing slipped by, and despite all the grumbling I did when I received the corrections, thank you! This wouldn't have been possible without you.

      I would also like to thank Atmel for their time and effort, for the engineers I was in contact with to get more information, and to Tom Vu who kept on encouraging me along the way and sending me new evaluation boards to play with. My thanks also go out to Silicon Labs for its excellent UV sensor that is presented in this book and for the time it spent helping me. Thanks to Materiel.net who managed to get me a new computer, camera, and components in record time when mine broke, allowing me to get the job done. Your coffee mug is still on my desk!

      Of course, this book would not have been possible without the amazing people at Arduino. I don't know if they know just how much they have changed the world of makers. Your boards have brought back the joy I had in creating gizmos and contraptions.

      This has been a huge adventure, and I've met a lot of amazing people along the way. Thank you to every one of you – for your time, your suggestions, and your encouraging messages.

      Introduction

      Arduinos have opened up a new world to us. Both makers and professionals use Arduino-based systems to create wonderful and complex devices to help to create fascinating gizmos. From the simplest device that turns on a light when you press a button to advanced 3-D printers, you can use Arduinos in just about every application.

      To power all this, Arduinos use sketches– software programs that you design to complete your device. They communicate with the outside world and are logic behind your projects. To assist you, the Arduino environment has libraries– software that you can add as required, depending on your application or the hardware that you add. Each library is explained in this book with examples for each library.

      This book introduces you to Arduino sketches, the software routines that you can use and the different libraries available for the different Arduinos that you will encounter.

      The Arduino can be your canvas, and your sketch can be your digital masterpiece.

      Overview of the Book and Technology

      This book covers everything you need to start using Arduinos. It presents the most common Arduinos on the market today, explains how to get your software up and running, and how to program the Arduino, but most important, it explains the Arduino programming languages and the different libraries that you can add to your designs to provide extra functionality. It also gives a primer in electronics to help you in the numerous examples throughout the book.

      How This Book Is Organized

      This book is designed to give as much information as possible to someone who is starting Arduino programming. It is separated into four parts.

      Part I, “Introduction to Arduino,” (Chapters 1–3) gives an overview of Arduinos – where they came from and why they are here to stay. It gives a primer on electronics and C programming, and also goes into the Arduino Language, the common elements that you will use for every project.

      Part II, “Standard Libraries,” (Chapters 4–17) is dedicated to the libraries available for every Arduino, that is, the different software components you can include to add functionality and hardware support. Each library is presented in its own chapter, and an example is provided for each library to help you understand its use.

      Part III, “Device-Specific Libraries,” (Chapters 18–23) is dedicated to libraries that are specific to different Arduinos; software you can add to a particular Arduino to access hardware or perform specific tasks. Again, each library is presented in its own chapter, and examples are provided.

      Part IV, “User Libraries and Shields,” (Chapters 24–26) is all about going even further with your Arduino; it explains how to import user libraries and how to design and distribute your own libraries. It also shows how to create your own shield, an electronic board that you can add to your Arduino to provide even more functionality.

      Who Should Read This Book

      This book is primarily for makers – people with ideas on how to create amazing applications or automate everyday tasks – and also for developers who want to get into the amazing world of Arduino programming.

      Tools You Need

      Each chapter has an example, and the exact components needed for that chapter are listed at the beginning of the chapter. To follow every example in this book, you need the following hardware:

      • Computer

      • USB cable and micro-USB cable

      • power supply

      • Breadboard with connector cables

      • Several Arduinos:

      • 2 x Arduino Uno

      • Arduino Due

      • Arduino Mega 2560

      • Arduino Esplora

      • Arduino Robot

      • Arduino

      • SainSmart LCD Shield

      • SainSmart Ethernet Shield

      • LM35 Temperature Sensor

      • SD card

      • Arduino GSM Shield

      • Adafruit ST7735 TFT breakout board

      • Adafruit MAX31855 breakout board

      • Type-K thermocouple wire

      • Adafruit SI1145 UV Sensor board

      • SainSmart Wi-Fi shield

      • DHT11 Humidity sensor

      • HC-SR04 ultrasonic distance sensor

      • HYX-S0009 or equivalent servo motor

      • L293D

      • bipolar stepper motor

      • Red, green, and blue LEDs

      • 10-kilohm resistors

      • 4.7-kilohm resistors

      What's on the Website

      The source code for the samples is available for download from the Wiley website at www.wiley.com/go/arduinosketches.

      Summary

      Arduino development is a fascinating subject, one that opens up a whole new world of possibilities. Arduinos are perfectly suited for learning about embedded development, but also for automating everyday tasks or even making amazing gizmos and contraptions. Throughout this book, you'll find numerous examples about how to create simple devices, providing a hardware