pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Tof

Example

Retrieves and prints the distance value from the sensor.

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

setScreenColor(0x111111)

hat_tof_0 = hat.get(hat.TOF)

while True:
  print(hat_tof_0.GetDistance())
  wait_ms(2)

API

hat_tof_0.GetDistance()
  • Retrieves the distance data measured by the sensor.
On This Page