Info
LEGO has published official docs on the hub-module: https://lego.github.io/MINDSTORMS-Robot-Inventor-hub-API/
The Led class controls all functions linked to the led ring around the center button on the hub.
led(color)¶
hub.led(color)
Turn on the led with a given ledcolor
Parameter:
- ledcolor:
0: Off
1: Pink
2: Violet
3: Blue
4: Light blue
5: Light green
6: Green
7: Yellow
8: Orange
9: Red
10: Bright white
11: white
Sample code:
import hub
hub.led(7) # set led light to yellow
led(r,g,b)¶
hub.led(r,g,b)
Turn the led color to a color defined by RGB values
Parameters:
- r int red value between 0 and 255
- g int green value between 0 and 255
- b int blue value between 0 and 255
Info
keep in mind that the colors seem skewed towards blue
Returns:
- tuple (int r,int g,int b) each has a value between 0 and 255. Only if no arguments are given.
Sample code:
import hub
hub.led(0,100,50)