Last active
February 16, 2022 23:26
-
-
Save FoamyGuy/9fa32723fe39c261f4bf8529ddc50409 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import board | |
from adafruit_lc709203f import LC709203F | |
import terminalio | |
from adafruit_display_text import bitmap_label | |
from displayio import Group | |
text_area = bitmap_label.Label(terminalio.FONT, scale=2) | |
text_area.anchor_point = (0.5, 0.5) | |
text_area.anchored_position = (board.DISPLAY.width // 2, board.DISPLAY.height // 2) | |
main_group = Group() | |
main_group.append(text_area) | |
print("LC709203F test") | |
print("Make sure LiPoly battery is plugged into the board!") | |
sensor = LC709203F(board.I2C()) | |
print("IC version:", hex(sensor.ic_version)) | |
board.DISPLAY.show(main_group) | |
while True: | |
text_area.text = "Battery: {}%\nVolts: {}".format(sensor.cell_percent, sensor.cell_voltage) | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment