mirror of
https://github.com/pimoroni/grow-python
synced 2025-10-25 15:19:23 +00:00
Explicitly stop pump upon exit
This commit is contained in:
@@ -32,6 +32,12 @@ class Pump(object):
|
|||||||
|
|
||||||
self._timeout = None
|
self._timeout = None
|
||||||
|
|
||||||
|
atexit.register(self._stop)
|
||||||
|
|
||||||
|
def _stop(self):
|
||||||
|
self._pwm.stop(0)
|
||||||
|
GPIO.setup(self._gpio_pin, GPIO.IN)
|
||||||
|
|
||||||
def set_speed(self, speed):
|
def set_speed(self, speed):
|
||||||
"""Set pump speed (PWM duty cycle)."""
|
"""Set pump speed (PWM duty cycle)."""
|
||||||
if speed > 1.0 or speed < 0:
|
if speed > 1.0 or speed < 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user