Led
This module contains the LED class.
CLASS | DESCRIPTION |
---|---|
LED |
LED class |
Multi_LED |
Multi-channel LED class |
Documentation last updated: 2025-02-22
LED
Bases: TimedDeviceMixin
, Maker
LED class
ATTRIBUTE | DESCRIPTION |
---|---|
channel |
channel number
TYPE:
|
target_power |
target power level
TYPE:
|
timer_event |
timer event
TYPE:
|
threads |
threads
TYPE:
|
METHOD | DESCRIPTION |
---|---|
dark |
Darken the LED |
light |
Light up the LED |
stop |
Stop the LED |
getPower |
Get the power level of the LED |
setPower |
Set the power level of the LED |
setValue |
Set the power level of the LED |
updatePower |
Update the power level of the LED |
execute |
Execute the dark and spin steps |
shutdown |
Shutdown procedure for the LED |
Initialize the LED class
PARAMETER | DESCRIPTION |
---|---|
port
|
port to connect to. Defaults to 'COM0'.
TYPE:
|
channel
|
channel number. Defaults to 0.
TYPE:
|
baudrate
|
baudrate for connection. Defaults to 9600.
TYPE:
|
verbose
|
verbosity of class. Defaults to False.
TYPE:
|
dark
Darken the LED for a given duration
PARAMETER | DESCRIPTION |
---|---|
duration
|
duration to darken the LED
TYPE:
|
blocking
|
whether to block the thread. Defaults to True.
TYPE:
|
execute
execute(
dark_time: int | float = 0,
power: int = 255,
light_time: int | float = 1,
blocking: bool = True,
*args,
**kwargs,
)
Execute the dark and light steps
PARAMETER | DESCRIPTION |
---|---|
dark_time
|
dark time. Defaults to 0.
TYPE:
|
power
|
power level. Defaults to 255.
TYPE:
|
light_time
|
light time. Defaults to 1.
TYPE:
|
blocking
|
whether to block the thread. Defaults to True.
TYPE:
|
getAttributes
Get relevant attributes of the class
RETURNS | DESCRIPTION |
---|---|
dict
|
relevant attributes
TYPE:
|
getPower
Get the current power level of the LED
RETURNS | DESCRIPTION |
---|---|
int
|
power level
TYPE:
|
light
Light up the LED at a given power level for a given duration
PARAMETER | DESCRIPTION |
---|---|
power
|
power level
TYPE:
|
duration
|
duration to light up the LED
TYPE:
|
blocking
|
whether to block the thread. Defaults to
TYPE:
|
setPower
Set power level of LED
PARAMETER | DESCRIPTION |
---|---|
power
|
power level
TYPE:
|
event
|
event to set. Defaults to None.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
whether the power level was set
TYPE:
|
setTargetPower
Set power level of LED
PARAMETER | DESCRIPTION |
---|---|
power
|
power level
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
whether the power level was set
TYPE:
|
setValue
Set the power level of the LED
PARAMETER | DESCRIPTION |
---|---|
value
|
power level
TYPE:
|
event
|
event to set. Defaults to None.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
whether the power level was set
TYPE:
|