Digital output is used to control devices. LEDs are just an easy and visual way to check that things work, and we will start by revisiting them to set the concepts and then look at relays, which are one of the most versatile components we can use.
Using GPIO for output
LEDs
In this section we will see how to handle LEDs directly, learn a bit more about PeripheralManager (the class you use to access peripherals), and understand how GPIO works for output.
So, let's begin by replacing the utility method from the Rainbow HAT meta driver with some code that accesses the pins directly.
Given that we are already using a Gpio object to handle the LEDs, the only part that we need to change is how to open it. We already looked...