UIFlow Guide
Control multiple servos to rotate at specific angles every second in a loop. You can continue to add more servos if needed.
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)