RGBLed
MiniThe robot’s colour light; colours are red, green and blue from 0 to 255, brightness in percent.
How you reach it
Section titled “How you reach it”The RGBLed class is reached through this attribute of robot.
robot.rgb_led
Section titled “robot.rgb_led”Can be None.
All the attributes of robot are in its table. Read Attributes that can be None to see when a part is None.
Properties
Section titled “Properties”The colour last set, as (red, green, blue), each 0 to 255, before brightness.
color: Tuple[int, int, int]Read only.
Used in examples: Rainbow
brightness
Section titled “brightness”The brightness last set, 0 to 100 percent.
brightness: intRead only.
Used in examples: Rainbow
Methods
Section titled “Methods”set_color(r, g, b, index)
Section titled “set_color(r, g, b, index)”Lights the LED in a colour made of red, green and blue, each from 0 to 255.
set_color(r, g, b, index: int)You can leave out index.
Used in examples: Drive the Mini, Rainbow, Jukebox, Mini eyes
set_hex(hex_color, index)
Section titled “set_hex(hex_color, index)”Lights the LED in a colour written as one number 0xRRGGBB, for example 0xFF8000 for orange.
set_hex(hex_color, index: int)You can leave out index.
Used in examples: Rainbow
set_brightness(brightness)
Section titled “set_brightness(brightness)”Sets how bright the colour shows, from 0 to 100 percent, without changing the colour.
set_brightness(brightness)Used in examples: Rainbow
set_preset(preset_id)
Section titled “set_preset(preset_id)”Lights one of the app’s preset colours, by its number (0 is off, 1 red, 2 green, 3 blue, …).
set_preset(preset_id)Used in examples: Rainbow
Turns the light off and stops blink() or rainbow().
off()Used in examples: Drive the Mini, Rainbow, Jukebox, Mini eyes
flash(r, g, b, duration_ms)
Section titled “flash(r, g, b, duration_ms)”Flashes a colour (red, green and blue, each 0 to 255) for duration_ms milliseconds, then puts back the colour the light had; the program waits meanwhile.
flash(r, g, b, duration_ms: int)You can leave out duration_ms.
Used in examples: Rainbow
blink(r, g, b)
Section titled “blink(r, g, b)”Starts blinking a colour (0-255 each), on and off every 200 ms; call tick() in your loop to move it on.
blink(r, g, b)Used in examples: Rainbow
rainbow()
Section titled “rainbow()”Starts cycling through eight colours, one every 300 ms; call tick() in your loop to move it on.
rainbow()Used in examples: Rainbow
tick()
Section titled “tick()”Moves blink() or rainbow() on; call it every 20-50 ms from your loop.
tick()Used in examples: Rainbow