mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-12-08 20:39:01 +00:00
Rename to gpiozero and tidy up
This commit is contained in:
25
gpiozero/output_devices.py
Normal file
25
gpiozero/output_devices.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from RPi import GPIO
|
||||
|
||||
|
||||
class OutputDevice(object):
|
||||
def __init__(self, pin):
|
||||
self.pin = pin
|
||||
GPIO.setup(pin, GPIO.OUT)
|
||||
|
||||
def on(self):
|
||||
GPIO.output(self.pin, True)
|
||||
|
||||
def off(self):
|
||||
GPIO.output(self.pin, False)
|
||||
|
||||
|
||||
class LED(OutputDevice):
|
||||
pass
|
||||
|
||||
|
||||
class Buzzer(OutputDevice):
|
||||
pass
|
||||
|
||||
|
||||
class Motor(OutputDevice):
|
||||
pass
|
||||
Reference in New Issue
Block a user