Developing a diagnostic mode
With a working prototype, it's time to add a functionality that we can use to test our circuit. Even if we are tempted to put our hands on code, we need first to simulate a physical damage that causes a fault in the prototype. Because we don't want to really damage one of our LEDs, we can always alter the circuit components to reproduce an anomaly.
Indeed, we can simulate that the resistor connected to pin 3 has a broken leg. If this occurs, the circuit is interrupted and this prevents the current from flowing through the LED. To reproduce this problem in our breadboard, we can simply remove the first resistor, as we can see in the following schema:
Now we have simulated our first hardware fault. If we open the Android application and use the on/off switches, we can see that the second LED works as expected while the first one stops working. However, none of the software components notice anything because they are agnostic to what happens under the hood...