The Raspberry Pi makes an ideal match for the Internet of Things. But to put it to good use in IoT you need two areas of expertise, electronics and programming and, because of the way hardware and software engineering tend to occupy separate niches, you may need help with combining the two. This book teaches you to think like an IoT programmer.
In Raspberry Pi IoT in C you will find a practical approach to understanding electronic circuits and datasheets and translating this to code, specifically using the C programming language. The main reason for choosing C is speed, a crucial factor when you are writing programs to communicate with the outside world. If you are familiar with another programming language, C shouldn't be hard to pick up. This Second Edition has been brought up-to-date and focuses mainly on the Pi 4 and the Pi Zero. There is new material on the recently introduced GPIO character driver and using the Pi 4’s additional ports and scheduling.
Although NetBeans is used to develop programs, VS Code is now considered an alternative remote development environment and all the book’s code, which is available for download, has been tested with VS Code.
The main idea in this book is to not simply install a driver, but to work directly with the hardware using the Raspberry Pi's GPIO (General Purpose Input Output) to connect with off-the-shelf sensors. It explains how to use its standard output with custom protocols, including an in-depth exposition of the 1-wire bus. You will also discover how to put the Internet into the IoT using sockets.
After reading this book you will be in a better position to tackle interfacing anything-with-anything without the need for custom drivers and prebuilt hardware modules.
Harry Fairhead has worked with microprocessors and electronics in general for many years and is an enthusiastic proponent of the IoT. As well as being the Editor of IoT-Programmer.com, he is a regular contributor to I‑Programmer.info, where he covers all aspects of hardware. His other recent books include Applying C For The IoT With Linux as well as Fundamental C: Getting Closer To The Machine and Micro:bit IoT in C.