The Official Arduino Reference
First of all, be sure to check out the official Arduino Reference. It describes every function, variable, and structure available in the standard Arduino. Don’t skip this reference if you have not already looked through the Arduino reference.
Make: Action, Light and Sound
The book that really got me into coding is Simon Monk’s Make: Action, Movement, Light and Sound. This book covers useful projects involving robotics, sensing, and control. It was so interesting to learn how to code an arduino to make things happen and move about in the real world. Simon Monk is a regular writer for Make Community and is also author of the next recommended book.
The Arduino Cookbook by Michael Margolis contains over 700 pages of useful examples of how to solve common problems with Arduino. This is useful for developing your own projects and getting used to writing code to solve real world problems. I highly recommend this book.
Programming Arduino was my first programming book but I’ll admit this is maybe not the easiest place to start. I think it would be better to work with working examples from Make: Action or the Arduino Cookbook to see how the code actually does something cool. I think it is easier to get started that way rather than diving into some of the details of how Arduino programming works then seeing real word examples.
But at some point, when your code is not working and it is not clear why, this book provides the details.
Adafruit’s contribution to open source hardware can not be understated. The Arduino community owes so much to their work. To support their work, it is good to buy your components from Adafruit when you can.
The following will be a section that covers the basic parts of an arduino program and some details about how to actually structure and build your arduino code.
Having the right library makes all the difference. If you are using some peripheral like an OLED display or a sensor, you will likely need to pull in a library that allows you to easily interact with the extra device or sensor. Libraries can be downloaded using the library manager found at tools > manage libraries in your menu bar on a Mac or PC. If a library asks to download dependencies, you generally want to download everything the library is asking for.
A few of my favorite libraries are:
- Adafruit GFX Library – Graphics library
- Adafruit SSD1306 – Allows use of small OLED display
- Adafruit Unified Sensor – Used by many Adafruit sensor libraries
- wire – allows use of I2C sensors and components
- stepper – allows use of stepper motors
- Servo – easy control of servos
- VarSpeedServo – variable speed control of servos
You will find libraries that work for you by using boards and chips commonly used for Arduino and looking through some example code.
To find where your libraries are stored, go to arduino > preferences then check the sketchbook location. This is the path where all of your arduino libraries and sketches are found. Also, after you install a new library, you might need to restart your IDE (the arduino code editor) to be able to start using the new library.
If you are looking for a library for a certain chip, just google around for the library, in many cases if you are working with common Arduino chips, you will find a library that works for your chip.