
UiFlow Tutorial
Set motor parameters and control motor rotation
from m5stack import *
from m5ui import *
from uiflow import *
import unit
setScreenColor(0x222222)
hbridge_0 = unit.get(unit.HBRIDGE, unit.PORTA)
hbridge_0.init_i2c_address(0x20)
hbridge_0.set_8bit_pwm(127)
hbridge_0.set_16bit_pwm(32767)
hbridge_0.set_direction(1)
while True:
  print((str('Current:') + str(((str((hbridge_0.get_vin_current())) + str('A'))))))
  wait(1)
  wait_ms(2)hbridge_0.init_i2c_address(0x20)print(hbridge_0.get_adc_value(0, 8))print(hbridge_0.get_vin_current())print(hbridge_0.get_device_status(0xFE))print(hbridge_0.get_driver_config(4))hbridge_0.set_16bit_pwm(32767)hbridge_0.set_8bit_pwm(127)hbridge_0.set_direction(0)hbridge_0.set_pwm_freq(1000)