LED Board
Load Sound and Light Style from Resource Library
Read the saved LED style.
- Function name: Method
load_led_styleunder [Robot] - Parameters:
- name: [str] Name
- dir: [str] Workspace name. Optional, default root directory
- Return: [LedStyle] Sound and light style
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "load_led_style", "params": [{"name": "", "dir": ""}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {"led": {}, "voice": 0, "volume": 0}, "id": 1 }
Example Program
style = lebai:load_led_style("style1")
print(style)
style = lebai.load_led_style("style1")
print(style)
Set Sound and Light Style
Set LED style (mode, speed, color, sound, volume).
- Function name: Method
set_led_styleunder [Robot] - Parameters:
- style: [LedStyle] Sound and light style
- Return: None
Example Program
style = {mode = 2, speed = 1, colors = {0, 1, 2}, voice = 1, volume = 2}
lebai:set_led_style(style)
style = {'mode': 2, 'speed': 1, 'colors': [0, 1, 2], 'voice': 1, 'volume': 2}
lebai.set_led_style(style)
Set LED Light Status
- Function name: Method
set_ledunder [Robot] - Parameters:
- mode: [int] Light mode.
0Unchanged.1Off.2Solid.3Breathing.4Even rotation.5Same color rotation.6Blinking.
- speed: [int] Speed.
1Fast.2Normal.3Slow.
- colors: [list[int]] Up to 4 integers between 0~15, corresponding colors as follows:
- mode: [int] Light mode.
- Return: None
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
Example Program
lebai:set_led(3, 1, {0, 1, 2})
lebai.set_led(3, 1, [0, 1, 2])
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "set_led", "params": [{"mode": 1, "speed": 1, "colors": [0]}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Set Sound
- Function name: Method
set_voiceunder [Robot] - Parameters:
- voice: [int] Sound list.
0Unchanged1Xiaobai is starting up, please wait2Xiaobai is trying to stop3Warning, collision detected4Updating, please wait5Teaching mode enabled6Teaching mode exited7Fine-tuning started8Fine-tuning ended9Fine-tuning direction changed10Xiaobai is so bored, let's play a game together
- volume: [int] Volume.
0Mute.1Low.2Normal.3High.
- voice: [int] Sound list.
- Return: None
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "set_voice", "params": [{"voice": 1, "volume": 1}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
lebai:set_voice(1, 2)
lebai.set_voice(1, 2)
Toggle Fan
Note
When the system detects that the robot operating temperature is too high, it will automatically turn on the cooling fan.
- Function name: Method
set_fanunder [Robot] - Parameters:
- mode: [int] Fan mode.
1Off.2On.
- mode: [int] Fan mode.
- Return: None
JSON-RPC
// Request:
{ "jsonrpc": "2.0", "method": "set_fan", "params": [{"mode": 1}], "id": 1 }
// Response:
{ "jsonrpc": "2.0", "result": {}, "id": 1 }
Example Program
lebai:set_fan(2)
lebai.set_fan(2)
