Module Led :: Class Led
[hide private]
[frames] | no frames]

Class Led

source code

Instance Methods [hide private]
 
__init__(self, id)
Creates a Led instance with given ID.
source code
 
setColor(self, *args)
Sets the RGB color value of the two LEDs with current ID.
source code
 
startBlinker(self, onColor, offColor, onTime, offTime, count=0, blocking=False)
Starts blinking with given onColor and offColor.
source code
 
stopBlinker(self)
Stops blinking and turns the led off.
source code
 
isBlinkerAlive(self)
Returns: True, if the blinker is displaying; otherwise False
source code
 
_checkRobot(self) source code
Static Methods [hide private]
 
setColorAll(*args)
Sets the RGB color of all 4 LED pairs.
source code
 
clearAll()
Turns off all 4 LED pairs.
source code
Class Variables [hide private]
  blinkerThreads = []
Class that represents a LED pair.
Method Details [hide private]

__init__(self, id)
(Constructor)

source code 

Creates a Led instance with given ID. IDs of the double LEDs: 0: front, 1: left side , 2: rear, 3: right side. The following global constants are defined: LED_FRONT = 0, LED_LEFT = 1, LED_REAR = 2, RED_RIGHT = 3.

Parameters:
  • id - the LED identifier

setColor(self, *args)

source code 

Sets the RGB color value of the two LEDs with current ID.
@param args list of [red, green, blue] RGB color components 0..255
    or three color integers 0..255 or X11-color string

startBlinker(self, onColor, offColor, onTime, offTime, count=0, blocking=False)

source code 

Starts blinking with given onColor and offColor. The blinking period is offTime + onTime. May be stopped by calling stopBlinker(). If blocking is False, the function returns immediately while the blinking goes on. The blinking is stopped by setColor().

Parameters:
  • onColor - color in on state. Must be X11 color string
  • offColor - color in off state. Must be X11 color string
  • onTime - the time in ms in on state
  • offTime - the time in ms in off state
  • count - total number of on states; 0 for endlessly (default)
  • blocking - if True, the method blocks until the blinker has finished; otherwise it returns immediately (default: False)

isBlinkerAlive(self)

source code 
Returns:
True, if the blinker is displaying; otherwise False

setColorAll(*args)
Static Method

source code 

Sets the RGB color of all 4 LED pairs.
@param color list of [red, green, blue] RGB color components 0..255
 or three color integers 0..255 or X11-color string