pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Vibration

Example

Set the vibration intensity and vibrate once every second.

from m5stack import *
from m5stack_ui import *
from uiflow import *
import time

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)

power.setVibrationIntensity(255)
while True:
  power.setVibrationEnable(True)
  wait(1)
  power.setVibrationEnable(False)
  wait(1)
  wait_ms(2)

API

power.setVibrationEnable(True)
  • Turn on the motor vibration.
power.setVibrationEnable(False)
  • Turn off the motor vibration.
power.setVibrationEnable(True)
wait(2)
power.setVibrationEnable(False)
wait_ms(2)
  • Set the vibration duration.
power.setVibrationIntensity(255)
  • Set the vibration intensity (0-255), where a larger value means a stronger vibration.
On This Page