Skip to content

Instantly share code, notes, and snippets.

@FoamyGuy
Last active February 16, 2022 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FoamyGuy/9fa32723fe39c261f4bf8529ddc50409 to your computer and use it in GitHub Desktop.
Save FoamyGuy/9fa32723fe39c261f4bf8529ddc50409 to your computer and use it in GitHub Desktop.
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