mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Refactor PiLiter into generic LEDBoard class
This commit is contained in:
@@ -101,9 +101,8 @@ class TrafficHat(FishDish):
|
|||||||
self._all = self._leds + (self.buzzer,)
|
self._all = self._leds + (self.buzzer,)
|
||||||
|
|
||||||
|
|
||||||
class PiLiter(object):
|
class LEDBoard(object):
|
||||||
def __init__(self):
|
def __init__(self, leds):
|
||||||
leds = (4, 17, 27, 18, 22, 23, 24, 25)
|
|
||||||
self._leds = tuple(LED(led) for led in leds)
|
self._leds = tuple(LED(led) for led in leds)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -133,3 +132,9 @@ class PiLiter(object):
|
|||||||
self.off()
|
self.off()
|
||||||
if i+1 < n: # don't sleep on final iteration
|
if i+1 < n: # don't sleep on final iteration
|
||||||
sleep(off_time)
|
sleep(off_time)
|
||||||
|
|
||||||
|
|
||||||
|
class PiLiter(LEDBoard):
|
||||||
|
def __init__(self):
|
||||||
|
leds = (4, 17, 27, 18, 22, 23, 24, 25)
|
||||||
|
super(PiLiter, self).__init__(leds)
|
||||||
|
|||||||
Reference in New Issue
Block a user