Writing testable robot programs
Gaining insight into the inner workings of the program that is running on your Arduino with your own senses is even more difficult than debugging the electronic systems of your robot. That is why it is important to design and write your robot programs with testability in mind from the very beginning.
The most important aspect of testability is modularity. This lets you run a smaller program that only contains some parts of the overall program and test these parts independently. In the previous chapters, we have already learned important techniques for modularity—namely, cooperative multitasking and object-oriented programming (OOP). If your program consists of multiple cooperative tasks running at the same time, you can simply disable all but one task to only test this one. And if you have a class that can perform a certain core function, such as the Blinker
class we developed in Chapter 6, Understanding Object-Oriented Programming and Creating...