-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
23 lines (21 loc) · 1.04 KB
/
Copy pathmain.py
File metadata and controls
23 lines (21 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from machine import Pin, I2C
from axp192 import AXP192
import time
i2c = I2C(0, scl=Pin(22), sda=Pin(21), freq=400000)
pmu = AXP192(i2c)
while True:
print("localtime : {}".format(time.localtime()))
print("battery level : {}%".format(pmu.get_battery_level()))
print("battery voltage : {}V".format(pmu.get_battery_voltage()))
print("battery current : {}mA".format(pmu.get_battery_current()))
print("battery power : {}mW".format(pmu.get_battery_power()))
print("battery charging current : {}mA".format(pmu.get_battery_charging_current()))
print("vin voltage : {}V".format(pmu.get_vin_voltage()))
print("vin current : {}mA".format(pmu.get_vin_current()))
print("vbus voltage : {}V".format(pmu.get_vbus_voltage()))
print("vbus current : {}mA".format(pmu.get_vbus_current()))
print("aps voltage : {}V".format(pmu.get_aps_voltage()))
print("temperature : {}C".format(pmu.get_temperature()))
print("warning level : {}".format(pmu.get_warning_level()))
print("")
time.sleep(2)