We are close to building our IoT weather dashboard. The final steps involve controlling our servo position based on the weather data returned from the Yahoo! Weather web service and physically building a backdrop for our servo needle.
Controlling the servo using weather data
Correcting for servo range
As some of you may have noticed, your servo motor does not move a full 180 degrees from minimum to maximum. This is due to the minimum and maximum pulse widths of 1 ms and 2 ms set in GPIO Zero. To account for this difference, we must adjust the min_pulse_width and max_pulse_width properties accordingly when we instantiate a Servo object.
The following code does just that. The variable, servoCorrection, adds to and subtracts...