pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

PIR

案例程序

串口输出人体传感器的感应数值

from m5stack import *
from m5ui import *
from uiflow import *
import hat
import hat

setScreenColor(0x111111)

hat_pir_0 = hat.get(hat.PIR)

while True:
  print(hat_pir_0.state)
  wait_ms(2)

功能说明

hat_pir_0.state
  • 用于获取指定PIR传感器的状态,通常用于检测是否有运动发生
On This Page