123456789101112131415161718192021 |
- from machine import Pin
- # 设备类型
- model = '01001'
- led = Pin(4, Pin.OUT)
- def command(com):
- """
- 执行命令
- """
- if com == 'on':
- led.on()
- elif com == 'off':
- led.off()
- def status():
- """
- 上报状态
- """
- return {
- 'status': led.value() == 1
- }
|