pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Module Servo2

案例程序

from m5stack import *
from m5ui import *
from uiflow import *
import module

import time
setScreenColor(0x222222)
servo2 = module.get(module.SERVO2)

while True:
  servo2.position(0, 0)
  wait_ms(100)
  servo2.position(0, 90)
  wait_ms(100)
  wait_ms(2)

功能说明

servo2.position(ch, deg)
  • 设置舵机旋转角度:
    • ch: 0-15
    • deg: 0-180
servo2.position(ch, duty=0)
  • 设置舵机脉冲占空比:
    • ch: 0-15
    • duty: 0-100
servo2.position(ch, us=400)
  • 设置舵机脉冲时间:
    • ch: 0-15
    • duty: 400-2500us
servo2.release(ch)
  • 释放舵机电源:
    • ch: 0-15
On This Page