UIFlow Guide
控制多个舵机循环每隔一秒转动一个角度,你可以继续添加舵机数量
from m5stack import *
from m5ui import *
from uiflow import *
import time
import hat
setScreenColor(0x111111)
hat_servos_1 = hat.get(hat.SERVOS)
hat_servos_1.SetAngle(1, 0)
hat_servos_1.SetAngle(2, 0)
hat_servos_1.SetAngle(3, 0)
hat_servos_1.SetAngle(4, 0)
wait(1)
hat_servos_1.SetAngle(1, 90)
hat_servos_1.SetAngle(2, 90)
hat_servos_1.SetAngle(3, 90)
hat_servos_1.SetAngle(4, 90)
wait(1)
hat_servos_1.SetAngle(1, 180)
hat_servos_1.SetAngle(2, 180)
hat_servos_1.SetAngle(3, 180)
hat_servos_1.SetAngle(4, 180)
wait(1)
hat_servos_1.SetAngle(1, 90)
hat_servos_1.SetAngle(2, 90)
hat_servos_1.SetAngle(3, 90)
hat_servos_1.SetAngle(4, 90)
wait(1)
hat_servos_1.SetAngle(1, 0)
hat_servos_1.SetAngle(2, 0)
hat_servos_1.SetAngle(3, 0)
hat_servos_1.SetAngle(4, 0)
wait(1)
hat_servos_0.SetAngle(1, 0)
hat_servos_0.SetPulse(1, 600)
hat_servos_0.SetRGB(0xff0000)
hat_servos_0.SetRGB(0x000000)