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()
Copy

API

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