pdf-icon

UIFlow Guide

UiFlow1 Blockly

Event

Unit

UiFlow1 Project

Module13.2 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
Example
API
Q&A
Submit a question
Select question category*
Arduino
MicroPython
UIFlow1
UIFlow2
EzData
M5Burner
Software
Hardware
Other
Product name
Product version
Question description*
(Supports pasting screenshots.)
Attachments
Add Files
Email*
Submit
OK

M5Stack Support

Hi, this is M5Stack Support. How can I help you today?