We will start our code exploration by looking at the external libraries we are importing in our Python program. They appear near the top of the source file, as shown here:
from gpiozero import Device, LED # (1)
from gpiozero.pins.pigpio import PiGPIOFactory # (2)
from time import sleep
The imports of interest are the following:
- At line (1), we import the Device and LED classes from the GPIOZero package.
- At line (2), we are importing a GPIOZero Pin Factory. This is used together with the Device class, which we'll see next.
Next, we see how to set the GPIOZero Pin Factory implementation.