pdf-icon

UIFlow Guide

UiFlow1 Blockly

Event

Unit

UiFlow1 Development Guide

Project Management

UiFlow2 Development Guide

UI Editor

Device Security & Sharing

Unit PaHUB

Example

Through the Unit PaHUB branch line, connect multiple Unit ToF to realize the laser ranging function of Unit ToF

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

setScreenColor(0x222222)
pahub_0 = unit.get(unit.PAHUB, unit.PORTA, 0x70)
tof_0 = unit.get(unit.TOF, unit.PAHUB0)

label0 = M5TextBox(130, 119, "label0", lcd.FONT_Default, 0xFFFFFF, rotate=0)
pahub_0.select(0, 1)
while True:
  print(tof_0.distance)
  label0.setText(str(tof_0.distance))
  wait_ms(2)

API

pahub_0 = unit.get(unit.PAHUB, unit.PORTA, 0x70)
  • Set the channel status to Open (Channel selection)
pahub_0 = unit.get(unit.PAHUB, unit.PORTA, 0x70)
  • Set channel status to open (channel controlled by variable)
pahub_0 = unit.get(unit.PAHUB, unit.PORTA, 0x70)
  • Set the value (hexadecimal) corresponding to the channel for communication
pahub_0 = unit.get(unit.PAHUB, unit.PORTA, 0x70)
  • Set channel status (Channel selection)
pahub_0 = unit.get(unit.PAHUB, unit.PORTA, 0x70)
  • et channel state by variable (channel variable control)
On This Page