PIR Unit
支持以下产品:
Micropython Example:
import os, sys, io
import M5
from M5 import *
from hardware import *
from unit import *
i2c0 = None
pir_0 = None
def setup():
global i2c0, pir_0
i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
pir_0 = PIR((8, 9))
M5.begin()
Widgets.fillScreen(0x222222)
print(pir_0.get_status())
UIFLOW2 Example:
class PIR
Constructors
- class PIR(IO1, IO2)
创建一个PIR对象.
- 参数是:
IO1,IO2
I2C引脚。
UIFLOW2:
Methods
- PIR.get_status()
获取检测状态
UIFLOW2:
- PIR.enable_irq()
使能人体检测功能。
UIFLOW2:
- PIR.disable_irq()
关闭人体检测功能。
UIFLOW2:
- PIR.set_callback()
轮询方法,放在loop函数里面,不断检测。
UIFLOW2: