UIFlow Guide
控制电机旋转
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit
setScreenColor(0x222222)
pbhub_0 = unit.get(unit.PBHUB, unit.PORTA)
while True:
pbhub_0.setServoAngle(0, 0, 11)
wait(1)
pbhub_0.setServoAngle(0, 0, 180)
wait(1)
wait_ms(2)
pbhub_0.init_i2c_address(0x61)
print(pbhub_0.analogRead(0))
print(pbhub_0.digitalRead(0, 0))
pbhub_0.digitalWrite(0, 0, 0)
print(pbhub_0.pwmRead(0, 0))
pbhub_0.pwmWrite(0, 0, 0)
print(pbhub_0.read_status(0xFE))
pbhub_0.setBrightness(0, 50)
pbhub_0.setColorPos(0, 0, 0xff0000)
pbhub_0.setColorPos(0, 0, 0xff0000)
pbhub_0.setColor(0, 0, 0, 0xff0000)
pbhub_0.setColor(0, 0, 0, 0xff0000)
pbhub_0.setRgbNum(0, 1)
pbhub_0.init_i2c_address(0x61)
pbhub_0.setServoAngle(0, 0, 90)
pbhub_0.setServoPulse(0, 0, 1000)