UIFlow Guide
向前和向后交替运动
from m5stack import *
from m5ui import *
from uiflow import *
import time
import hat
setScreenColor(0x111111)
hat_bugc2_0 = hat.get(hat.BUGC2)
hat_bugc2_0.InitDeviceAddr(0x38)
while True:
hat_bugc2_0.SetMotorSpeed(0x00, 100)
hat_bugc2_0.SetMotorSpeed(0x02, 100)
hat_bugc2_0.SetMotorSpeed(0x01, -100)
hat_bugc2_0.SetMotorSpeed(0x01, -100)
wait(5)
hat_bugc2_0.SetMotorSpeed(0x00, -100)
hat_bugc2_0.SetMotorSpeed(0x02, -100)
hat_bugc2_0.SetMotorSpeed(0x01, 100)
hat_bugc2_0.SetMotorSpeed(0x03, 100)
wait(5)
wait_ms(2)
hat_bugc2_0.InitDeviceAddr(0x38)
hat_bugc2_0.GetAdcValue(8)
hat_bugc2_0.GetBatVoltage
hat_bugc2_0.GetDeviceSpec(0xFE)
hat_bugc2_0.SetRxCb(hat_bugc2_0_rx_cb)
hat_bugc2_0.SetI2cAddress(0x38)
hat_bugc2_0.SetMotorSpeed(0x00, 50)
hat_bugc2_0.SetRGBColor(0x00, 0xff0000)