This post is the first of a series which will explore and review books about Arduino, Raspberry Pi and electronics in general.
The book reviewed here is “C Programming for Arduino” written by Julien Bayle and published by Packt Publishing in March 2013.
“C Programming for Arduino” is a book for people who want to learn how to design and build their own electronic devices using Arduino, the most popular open-source electronics prototyping platform.
As you may imagine from the title, the focus is on the coding side of the platform, but all the examples discussed in the book come with adequate explanations about the wiring and the hardware in general.
At the time of writing, you can buy the book on the Packt Publishing website in e-book (£16.14 / 20.39€ / $25.49) or paperback + e-book (£30.99 / 38.99€ / $49.99) formats and from other online shops like Amazon, Barnes & Noble and Safari Books Online.
The book has 512 pages divided into 13 chapters, this section will provide you an overview of what you’re going to find in each of them.
1. Let’s Plug Things
As you may expect, the first chapter is used to introduce basic concepts. Here the author introduces the Arduino ecosystem giving a quick overview of the Arduino boards and shields, but obviously the main focus is on the Arduino IDE. After few pages dedicated to basic fundamental concepts like electricity, voltage and resistance the author introduces Fritzing, a program used to design digital circuits, and finally a first simple example: blinking an LED.
2. First Contact with C
The second chapter is an introduction to programming. The author discusses several programming paradigms, the main differences between C and C++ and introduces the “standard” libraries which come with the Arduino IDE and few other which don’t. Finally the first example showed in the first chapter is expanded adding serial communication with the PC.
3. C Basics – Making You Stronger
The third chapter goes into C programming more deeply explaining all the main concepts like: data types, variables, scope of a variable, qualifiers, operators, data conversion, branches and cycles.
4. Improve Programming with Functions, Math, and Timing
This chapter introduces functions, giving few examples of math functions and showing few functions used to deal with time in Arduino and some related concepts like polling, interrupts and threads. Finally there’s a simple example showing how to import and use an external library into the Arduino IDE.
5. Sensing with Digital Inputs
In chapter five the author introduces physical sensors and Processing, a framework and IDE used to create multimedia applications on computers in a simple way and which is often used to make Arduino boards interact with the PC via serial communication. An example of interaction is provided with a simple project in which some circles drawn in a Processing program are colored according to the state of some buttons on a breadboard.
6. Sensing the World – Feeling with Analog Inputs
This chapter is about analog input and after a brief introduction to analog input pins in Arduino boards and analog signals, there’s a first simple example: using a potentiometer to control the blinking delay of an LED. The central part of the chapter is dedicated to Max 6, a graphical programming framework and IDE, which in this chapter is used to visualize the value read from a distance sensor. Then few paragraph are spent on how to use a flexi sensor. Finally the author introduces the concept of multiplexing and demultiplexing and another example in which an analog multiplexer/demultiplexer is used to read 8 different analog values using a single analog pin of the Arduino board.
7. Talking over Serial
This chapter is dedicated to serial communication and mostly describes several serial protocols like RS-232, I2C, SPI and USB. No coding example is provided.
8. Designing Visual Output Feedback
Chapter 8 is about visual output, so mostly LEDs and how to control many of them. Several examples are provided, like using shift registers to control arrays of LEDs, controlling an RGB LED and creating a 3×3 matrix of LEDs. Finally the author explains the concept of PWM (Pulse With Modulation) to simulate analog output and concludes with a quick example about how to use an HD44780 compatible LCD.
9. Making Things Move and Creating Sounds
This chapter is dedicated to generating sounds and controlling motors (hobby servos and stepper motors) even if the main focus is on the former topic, which is discussed more deeply with more background theory and more examples.
10. Some Advanced Techniques
Chapter 10 provides several advanced examples, like using an EEPROM, using a GPS module, different ways to supply power to Arduino boards, drawing on a gLCD and using a Gameduino shield.
Chapter 11 is divided in two parts, in the first one the author introduces networking theory, whereas in the second one he provides several examples of networking with Arduino like using an ethernet board/shield, a bluetooth module and a WiFi shield.
12. Playing with the Max 6 Framework
In this chapter several examples of interaction between Arduino and the Max 6 framework are provided, mostly aimed at using Max 6 for visualization of what’s captured/controlled by an Arduino board.
13. Improving your C Programming and Creating Libraries
The final chapter is dedicated to some advanced topics, like creating your own library (with a detailed example), memory management, bit operations and finally reprogramming an Arduino board.
As for most of the things in life, this book comes with good and bad bits. Deciding if the good ones overcome the bad ones is probably something subjective, but in my personal opinion this book is pretty far from being perfect.
In the 13 chapters I read there are lots examples about many different topics, but all of them are quite basic and at the end you get a bit of everything without being able to acquire any decent knowledge. Some people like that, some people don’t, personally I don’t.
What I was expecting from this book (after reading the title) was probably less topics, but much more source codes and coding examples, maybe evolving the source code of a single project or making different things in code using the same hardware. Anyway, this book doesn’t deliver what I really expected.
Another thing I didn’t like is all the pages dedicated to Max 6, which is used in several chapters and got a whole chapter on its own, I really can’t get why, considering the book is “C Programming for Arduino” and not “Max 6 for Arduino”.
Another thing worth to mention is that the author is not a native English speaker so grammar and diction are not always perfect even if not in a way that makes the book impossible to read and probably you will only need to consider this if you are a grammar nazi.
Nevertheless “C Programming for Arduino” does a good job in introducing many basic concepts to wannabe tinkerers/coders, especially to those people who don’t have any experience with electronics and programming so it could be a good starting point for people new to the Arduino world.