pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Sonic IO

案例程序

获取Sonic IO采集的超声波测量数据

from m5stack import *
from m5ui import *
from uiflow import *
import unit

setScreenColor(0x222222)
sonic_io_0 = unit.get(unit.SONIC_IO, unit.PORTB)

while True:
  print(sonic_io_0.get_distance(1))
  wait_ms(2)

功能说明

print(sonic_io_0.get_distance(1))
  • 获得设备 Sonic IO 采集的超声波测量数据,返回一个 float 类型
On This Page