pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

POWER

Example

Wait for 5 seconds to power on, then power off after one 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.restart_after_seconds(0)
wait(1)
power.powerOff()

API

str(power.getChargeState())
  • Returns the charging state and outputs it as a string.
str(power.getChargeState())
  • Converts the returned battery voltage value to a string and outputs it.
str(power.getBatPercent())
  • Converts the returned battery percentage to a string and outputs it.
str(power.getBatCurrent())
  • Converts the returned battery current value to a string and outputs it.
str(power.getBatCurrent())
  • Converts the returned battery output current value to a string and outputs it.
str(power.getVBusVoltage())
  • Converts the returned VBus voltage value to a string and outputs it.
str(power.getPmuInTemp())
  • Converts the returned PMU internal temperature value to a string and outputs it.
power.powerOff()
  • Powers off.
power.setChargeCurrent(power.CURRENT_100MA)
  • Sets the charging current.
screen.set_screen_brightness(30)
  • Sets the screen brightness.
power.setPowerLED(True)
  • Sets the power indicator LED on or off.
power.setBusPowerMode(1)
  • Sets whether the Mbus bus power is output.
power.restart_after_seconds(0)
  • Sets the number of seconds until restart.
power.restart_on(minutes=0, hours=0, date=1, weekday=0)
  • Sets a specific time to restart.
On This Page