彩灯模块/Led

Methods

(static) setRgb(moduleIndex, r, g, b)

Source:
设置彩灯颜色(r,g,b 参数都设置为0时,关闭LED)
Parameters:
Name Type Description
moduleIndex int 模块序号
r int 红色:0~255
g int 绿色:0~255
b int 蓝色:0~255

(static) fadeToRgb(moduleIndex, r, g, b, time, block, step)

Source:
控制彩灯由当前颜色在指定时间渐变到目标颜色
Parameters:
Name Type Description
moduleIndex int 模块序号
r int 目标红色:0~255
g int 目标绿色:0~255
b int 目标蓝色:0~255
time float 渐变时间:0~60 s 变化到目标颜色所用的时间
block bool 阻塞参数: False: 不阻塞 True: 阻塞
step int 变化次数: 在渐变时间内经过多少次变化达到目标颜色

(static) getFirmwareVersion(moduleIndex) → {Promise.<int>}

Source:
获取当前模块版本号
Parameters:
Name Type Description
moduleIndex int 模块序号
Returns:
Type
Promise.<int>

(static) setOnboardRGB(moduleIndex, rgb)

Source:
设置板载LED的颜色
Parameters:
Name Type Description
moduleIndex int 模块序号
rgb int '红': 1,'绿':2,'蓝':3,'浅蓝':4,'黄':5,'紫':6,'白': 7,'不亮': 8