pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Atomic H-Driver

案例程序

from m5stack import *
from m5ui import *
from uiflow import *
from base.HDriver import HDriver
import time

hdriver = HDriver()
print((str('Input Voltage: ') + str((hdriver.get_voltage()))))
while True:
  print((str('Motor Fault Status: ') + str((hdriver.get_status()))))
  hdriver.set_speed(100)
  wait(1)
  hdriver.set_speed(0)
  wait(1)
  hdriver.set_speed(-100)
  wait(1)
  hdriver.set_speed(0)
  wait(1)
  wait_ms(2)

功能说明

from base.HDriver import HDriver
hdriver = HDriver()
  • 初始化Atomic H-Driver
hdriver.get_status()
  • 获取当前工作状态:
    • 0: Fault
    • 1: OK
hdriver.get_voltage()
  • 读取输入电压值(V)
hdriver.set_speed(100)
  • 控制电机转速:
    • 输入范围:-100~+100, 0为停止
On This Page