English
English
简体中文
日本語

UiFlow Tutorial

UiFlow1 Development Guide

Project Management

Use LTE network

UiFlow1 Blockly

Event

Unit

Hat PIR

Example

Outputs the sensor value of the PIR motion sensor to the serial monitor.

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

setScreenColor(0x111111)

hat_pir_0 = hat.get(hat.PIR)

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

API

hat_pir_0.state
  • Retrieves the state of the specified PIR sensor, typically used to detect motion presence.
Page Tools
PDF
On This Page