pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Thermal

Example

Retrieves and prints the center temperature, maximum temperature, and minimum temperature from the sensor.

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)

API

hat_thermal_0.getCenterTmp()
  • Retrieves the temperature at the center of the sensor’s field of view.
hat_thermal_0.getMaxTmp()
  • Retrieves the highest temperature detected by the sensor.
hat_thermal_0.getMinTmp()
  • Retrieves the lowest temperature detected by the sensor.
hat_thermal_0.getTmp(0, 0)
  • Retrieves the temperature at a specified pixel location (0, 0 in this example).
hat_thermal_0.setColorMaxTmp(35)
  • Sets the maximum visible temperature for color mapping (e.g., setting max to 35°C).
hat_thermal_0.setColorMinTmp(24)
  • Sets the minimum visible temperature for color mapping (e.g., setting min to 24°C).
hat_thermal_0.update(x=0, y=0, show=True, showCenter=True)
  • Updates the sensor display with optional settings for showing the center point and coordinates.
On This Page