The book: Practical Arduino C - complete text now free online
My book on C for Arduinos has an audience and that is reflected in the sporadic (and partly seasonal) sales. Sometimes selling well but with some months figures making grim reading.
I wrote the book to make the C (and C++) language a full partner with electronic skills for Arduino hobbyists and professionals. C skills complement hardware design skills and can potentially enable or enhance projects that might otherwise have failed to meet their design objectives.
I wrote the book to be read and to act as an ongoing resource for its readers. To that end I am going to make the complete book available on line - and free to read.
The process of moving the book content to HTML is a little time consuming as I wanted the presentation to match the printed page as closely as possible (along with some web style page navigation). That task may take a while to complete.
I have completed the first three full chapters and they are available now if you follow this link. Chapter three is a long one and covers the C language as expressed in the Arduino environment in some detail,
I will post updates here as new chapters are added.
<All Chapters now available>
Chapter 4: covers some Arduino specific functions and in passing, explores a quick project to get an Arduino to play a tune.
Chapter 5 gives some basic advice on debugging.
Chapter 6 starts the exploration of input and output through the board's pins
Chapter 7 is a thorough exploration of interrupts (although most timer interrupts feature in chapter 8)
Chapter 8 focuses on Timers and Pulse Width Modulation
Chapter 9 builds on that with Servo Motor control and Stepper Motors
Chapter 10 starts with a project that builds a State Machine
Chapter 11 looks as Sort Algorithms and concludes with Binary Search
Chapter 12 is based upon a project that starts by programming an Arduino to generate Morse code from a text source. This section also explores how data might be minimized when represented in a program.
The second phase of the project builds software on a second Arduino that can translate incoming Morse code back into text. The final version of this program demonstrates timely signal processing while simultaneously receiving more data. Such efficiency is based upon the development of two new data structures – a FiFo Queue and a Binary Tree.
The chapter then continues to develop a generic C FiFo Queue capable of storing and processing any arbitrary data together with a similarly flexible generic Binary tree. The chapter ends by exploring the process required to balance a binary tree and, in the process, introduces a double linked list structure.
Chapter 13 takes a look at C++ classes.
Chapter 14 applies C++ to monitor feedback from rotary encoders attached to a project's motor driven wheels. Explores the complex issues around handling interrupts using a C++ class.
Chapter 15 explores communications interfaces with short projects exploring serial, I2C, SPI and even parallel communications. The parallel project shows hoe ports can be used to reduce code size and enhance performance.
Chapter 16 is a project that applies a MKR 1010 WiFi Arduino to motor control, the real time clock, serving an interactive web page and downloading Internet data resources.
Chapter 17 covers some handy tips and tricks for formatting text being sent to the Serial Monitor or any other related object (such as an HTML client object)
Chapter 18 looks at various techniques for minimising the use of what is often rather limited SRAM.
Chapter 19 looks at the available functions in the standard C string.h, stdlib.h and math.h libraries.
Appendix 1 covers the parts list used by the projects in this book (with options)
Appendix 2 looks at the ASCII encoding
Appendix 3 is a handy table of operator precedence (an occasional lurking bug for the unwary).