pdf-icon

UIFlow 上手教程

UiFlow1 Blockly

Event

Unit

Hat Thermal

案例程序

获取传感器获取的物体中心位置温度和最高,最低温度

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

setScreenColor(0x111111)

hat_thermal_0 = hat.get(hat.MLX90640)

while True:
  print(hat_thermal_0.getCenterTmp())
  print(hat_thermal_0.getMaxTmp())
  print(hat_thermal_0.getMinTmp())
  wait_ms(2)

功能说明

hat_thermal_0.getCenterTmp()
  • 获取传感器视场中心点的温度值
hat_thermal_0.getMaxTmp()
  • 获取传感器检测到的最高温度值
hat_thermal_0.getMinTmp()
  • 获取传感器检测到的最低温度值
hat_thermal_0.getTmp(0, 0)
  • 获取指定像素位置的温度值(示例中为0,0坐标点)
hat_thermal_0.setColorMaxTmp(35)
  • 设置色温映射显示的最高温度值(例如设置为35°C)
hat_thermal_0.setColorMinTmp(24)
  • 设置色温映射显示的最低温度值(例如设置为24°C)
hat_thermal_0.update(x=0, y=0, show=True, showCenter=True)
  • 更新传感器显示,可选设置是否显示中心点和坐标位置
On This Page