PIR Unit
Support the following products:
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)
Create a PIR object.
- The parameters are:
IO1,IO2
I2C pin.
UIFLOW2:
Methods
- PIR.get_status()
Get detection status.
UIFLOW2:
- PIR.enable_irq()
Enable Human detection function.
UIFLOW2:
- PIR.disable_irq()
Disable Human detection function.
UIFLOW2:
- PIR.set_callback()
Polling method, placed in the loop function, constantly check.
UIFLOW2: