mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Add active_high and initial_value to LEDCollection, close #175
This commit is contained in:
@@ -28,8 +28,12 @@ class LEDCollection(SourceMixin, CompositeDevice):
|
|||||||
self._blink_thread = None
|
self._blink_thread = None
|
||||||
super(LEDCollection, self).__init__()
|
super(LEDCollection, self).__init__()
|
||||||
pwm = kwargs.get('pwm', False)
|
pwm = kwargs.get('pwm', False)
|
||||||
|
active_high = kwargs.get('active_high', True)
|
||||||
|
initial_value = kwargs.get('initial_value', False)
|
||||||
LEDClass = PWMLED if pwm else LED
|
LEDClass = PWMLED if pwm else LED
|
||||||
self._leds = tuple(LEDClass(pin) for pin in pins)
|
self._leds = tuple(
|
||||||
|
LEDClass(pin, active_high, initial_value) for pin in pins
|
||||||
|
)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
for led in self.leds:
|
for led in self.leds:
|
||||||
@@ -762,4 +766,3 @@ class CamJamKitRobot(Robot):
|
|||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(CamJamKitRobot, self).__init__(left=(9, 10), right=(7, 8))
|
super(CamJamKitRobot, self).__init__(left=(9, 10), right=(7, 8))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user