Add buzzer and led support
This commit is contained in:
0
rpi/hardware/led/__init__.py
Normal file
0
rpi/hardware/led/__init__.py
Normal file
15
rpi/hardware/led/led.py
Normal file
15
rpi/hardware/led/led.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import grovepi
|
||||
|
||||
class Led:
|
||||
|
||||
_pin : int
|
||||
|
||||
def __init__(self, pin : int):
|
||||
self._pin = pin
|
||||
grovepi.pinMode(self._pin, "OUTPUT")
|
||||
|
||||
def on(self):
|
||||
grovepi.digitalWrite(self._pin, 1)
|
||||
|
||||
def off(self):
|
||||
grovepi.digitalWrite(self._pin, 0)
|
||||
Reference in New Issue
Block a user