Leds¶
-
class
ev3dev2.led.
Led
(name_pattern='*', name_exact=False, desc=None, **kwargs)¶ Any device controlled by the generic LED driver. See https://www.kernel.org/doc/Documentation/leds/leds-class.txt for more details.
-
max_brightness
¶ Returns the maximum allowable brightness value.
-
brightness
¶ Sets the brightness level. Possible values are from 0 to max_brightness.
-
triggers
¶ Returns a list of available triggers.
-
trigger
¶ Sets the led trigger. A trigger is a kernel based source of led events. Triggers can either be simple or complex. A simple trigger isn’t configurable and is designed to slot into existing subsystems with minimal additional code. Examples are the ide-disk and nand-disk triggers.
Complex triggers whilst available to all LEDs have LED specific parameters and work on a per LED basis. The timer trigger is an example. The timer trigger will periodically change the LED brightness between 0 and the current brightness setting. The on and off time can be specified via delay_{on,off} attributes in milliseconds. You can change the brightness value of a LED independently of the timer trigger. However, if you set the brightness value to 0 it will also disable the timer trigger.
-
delay_on
¶ The timer trigger will periodically change the LED brightness between 0 and the current brightness setting. The on time can be specified via delay_on attribute in milliseconds.
-
delay_off
¶ The timer trigger will periodically change the LED brightness between 0 and the current brightness setting. The off time can be specified via delay_off attribute in milliseconds.
-
brightness_pct
¶ Returns led brightness as a fraction of max_brightness
-
-
class
ev3dev2.led.
Leds
¶ -
set_color
(group, color, pct=1)¶ Sets brigthness of leds in the given group to the values specified in color tuple. When percentage is specified, brightness of each led is reduced proportionally.
Example:
my_leds = Leds() my_leds.set_color('LEFT', 'AMBER')
With a custom color:
my_leds = Leds() my_leds.set_color('LEFT', (0.5, 0.3))
-
set
(group, **kwargs)¶ Set attributes for each led in group.
Example:
my_leds = Leds() my_leds.set_color('LEFT', brightness_pct=0.5, trigger='timer')
-
all_off
()¶ Turn all leds off
-
LED group and color names¶
EV3 platform
Led groups:
LEFT
RIGHT
Colors:
BLACK
RED
GREEN
AMBER
ORANGE
YELLOW
BrickPI platform
Led groups:
LED1
LED2
Colors:
BLACK
BLUE
BrickPI3 platform
Led groups:
LED
Colors:
BLACK
BLUE
PiStorms platform
Led groups:
LEFT
RIGHT
Colors:
BLACK
RED
GREEN
BLUE
YELLOW
CYAN
MAGENTA
EVB platform
None.