leds模块
控制设备LED显示
brightness
function led:brightness(value)
endtoggle
function led:toggle()
endblink
function led:blink(sec, dark_sec)
endcancel_blink
使用示例
Last updated
Was this helpful?
function led:brightness(value)
endfunction led:toggle()
endfunction led:blink(sec, dark_sec)
endLast updated
Was this helpful?
Was this helpful?
function led:cancel_blink()
endlocal leds = require 'utils.leds'
local cloud = leds.cloud --- 使用名称为cloud的LED, /sys/class/leds下的名称为 <id>:<color>:<name> 这里的cloud就是一个段名称, 其实际名称在Q102上是ld12:green:cloud。 如果存在name重复的led,则需要使用路径来调用:
-- local led_name = 'ld12:green:cloud'
-- local cloud = leds[led_name]
cloud:brightness(1) -- 点亮
cloud:brightness(0) -- 熄灭
cloud:blink(1, 1) -- 闪烁