pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Module Servo

Example

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

import time

setScreenColor(0x222222)
i = None

servo = module.get(module.SERVO)

import random

while True:
  i = random.randint(0, 180)
  servo.write_angle(0, i)
  servo.write_angle(1, i)
  servo.write_angle(2, i)
  servo.write_angle(3, i)
  servo.write_angle(4, i)
  servo.write_us(0, 600)
  print((str("Servo's Status") + str(i)))
  wait(0.5)
  wait_ms(2)

API

servo.write_angle(0, 180)
  • Drive Servo Rotation Angle
servo.write_us(0, 600)
  • Drive servo pulse duration
On This Page