pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Module Servo2

Example

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)

API

servo2.position(ch, deg)
  • Setting the servo rotation angle:
    • ch: 0-15
    • deg: 0-180
servo2.position(ch, duty=0)
  • Setting the Servo Pulse Duty Cycle:
    • ch: 0-15
    • duty: 0-100
servo2.position(ch, us=400)
  • Setting the servo pulse time:
    • ch: 0-15
    • duty: 400-2500us
servo2.release(ch)
  • Release servo power:
    • ch: 0-15
On This Page