pdf-icon

UiFlow Tutorial

UiFlow1 Development Guide

Project Management

Use LTE network

UiFlow1 Blockly

Event

Unit

UiFlow2 Development Guide

UI Editor

Device Security & Sharing

Unit Thermal

Example

The infrared sensor measures the temperature

from m5stack import *
from m5stack_ui import *
from uiflow import *
import time
import unit

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)
thermal_0 = unit.get(unit.THERMAL, unit.PORTA)

thermal_0.set_refresh_rate(0b000)
while True:
  print(thermal_0.get_temperature())
  thermal_0.update_temperature()
  wait(1)
  wait_ms(2)

API

print(thermal_0.get_center_temperature())
  • Get the temperature of the central area
print(thermal_0.get_max_temperature())
  • Get the maximum temperature
print(thermal_0.get_min_temperature())
  • Get the minimum temperature
print(thermal_0.get_pixel_temperature(0 , 0))
  • Get pixel-level temperature
print(thermal_0.get_refresh_rate())
  • Get the refresh rate
print(thermal_0.get_temperature())
  • Get the current temperature
thermal_0.set_refresh_rate(0b000)
  • Set the refresh rate
thermal_0.update_temperature()
  • Update the temperature data
On This Page