pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Roverc

Example

Loops to control the wheel speed and direction of RoverC, moving it in different directions with a 1-second delay.

from m5stack import *
from m5ui import *
from uiflow import *
import time
import hat

setScreenColor(0x111111)

hat_roverc_0 = hat.get(hat.ROVERC)

while True:
  hat_roverc_0.SetAllPulse(20, 20, 20, 20)
  wait(1)
  hat_roverc_0.SetSpeed(0, (-20), 0)
  wait(1)
  hat_roverc_0.SetAllPulse(20, (-20), (-20), 20)
  wait(1)
  hat_roverc_0.SetSpeed((-20), 0, 0)
  wait(1)
  wait_ms(2)

API

hat_roverc_0.SetAllPulse(0, 0, 0, 0)
  • Sets the pulse width for RoverC's four wheels: front-left, front-right, rear-left, and rear-right, controlling the movement of each wheel.
hat_roverc_0.SetPulse(0, 0)
  • Sets the pulse width for a specified wheel; here, the front-left wheel is specified.
hat_roverc_0.SetServoAngle(0, 0)
  • Sets the angle position of a specified servo, with the value representing the rotation angle.
hat_roverc_0.SetServoPulse(0, 500)
  • Sets the pulse width for a specified servo, controlling its action.
hat_roverc_0.SetSpeed(0, 0, 0)
  • Sets the movement speed of RoverC, controlling speed across the X, Y, and Z axes.
On This Page