Jerry Seinfeld once joked that all we need to know about the weather is: Should we bring a coat or not? For the rest of this chapter and the next, we will build an analog meter needle dashboard to indicate the wardrobe needed for the weather conditions.
We will also add an LED that will turn on to indicate that an umbrella is needed, and flash to indicate a very bad storm.
Before we can build the dashboard in Chapter 6, Working with the Servo Control Code to Control an Analog Device, we need code to control the servo and LED. We will start by creating a class to do just that.
This class will set the servo position and LED state on our circuit:
- Open up Thonny from Application Menu | Programming | Thonny Python IDE
- Click on the New icon to create a new file
- Type the following:
from gpiozero import Servo
from gpiozero import LED
class...