pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Balac

案例程序

控制balac前进,左右转弯以及后退

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

setScreenColor(0x111111)

balac = hat.get(hat.BALAC)

balac.set_motor_speed(1, 50)
balac.set_motor_speed(2, 50)
wait(1)
balac.set_motor_speed(1, 50)
balac.set_motor_speed(2, 0)
wait(1)
balac.set_motor_speed(1, 0)
balac.set_motor_speed(2, 50)
wait(1)
balac.set_motor_speed(1, -50)
balac.set_motor_speed(2, -50)
wait(1)
balac.stop_motor(1)
wait(1)

功能说明

balac.set_motor_speed(1, 50)
  • 设置直流电机A的速度,当前速度为50,最大255
balac.stop_motor(1)
  • 停止直流电机A的运行
On This Page