pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit Vibrator

Example

from m5stack import *
from m5ui import *
from uiflow import *
import unit

setScreenColor(0x222222)
vibrator_0 = unit.get(unit.VIBRATOR, unit.PORTA)

def buttonA_wasPressed():
  # global params
  vibrator_0.off()
  pass
btnA.wasPressed(buttonA_wasPressed)

def buttonB_wasPressed():
  # global params
  vibrator_0.on(10)
  pass
btnB.wasPressed(buttonB_wasPressed)

API

vibrator_0.off()
  • Turn off the motor
vibrator_0.on(10)
  • Set the vibration duty cycle
On This Page