-
I am currently wondering, due to Novakasa/brickrail#140, how battery shutdown is handled with pybricks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
No, it doesn't shut down until 4.8V. https://github.com/pybricks/pybricks-micropython/blob/master/lib/pbio/sys/battery.c
If you have a Bluetooth connection, the status events include a low battery voltage warning flag. |
Beta Was this translation helpful? Give feedback.
-
The hubs (I think all of them) have a battery.voltage() function. An example: from pybricks.hubs import CityHub
from pybricks.tools import wait
hub = CityHub()
# from doc: "Using the battery"
# battery.voltage()→ int: mV
for i in range(10):
print(hub.battery.voltage())
wait(1000) Sample output:
I am using something similar to check the battery of my EV3 to warn using the leds to flash yellow or orange or red depending on the voltage. |
Beta Was this translation helpful? Give feedback.
No, it doesn't shut down until 4.8V. https://github.com/pybricks/pybricks-micropython/blob/master/lib/pbio/sys/battery.c
If you have a Bluetooth connection, the status events include a low battery voltage warning flag.