In the proceeding example, we used PWMLED, not LED, from GPIOZero. PWMLED allows us to control the brightness of the LED using a technique known as Pulse Width Modulation, commonly abbreviated as PWM.
PWM is a technique used to create a lower the average voltage from a source signal, which can be a 3.3-volt GPIO pin. We will be covering PWM and GPIO pin voltages in detail in Chapter 6, Electronics 101 for the Software Engineer.
For our current example, briefly (and somewhat oversimplified), PWM pulses the LED on and off really, really fast, and our eyes observe different pulse durations (that are creating different voltages) manifesting as different brightness levels of the LED. We changed this pulse duration (known as the duty-cycle) using the value property of a PWMLED instance, that is, led.value = state["level"] in LEDControl.post(). In Chapter 5, Connecting Your Raspberry Pi to the Physical World, we will explore...