Include LC709203 example.

This commit is contained in:
Kattni Rembor 2022-02-25 18:11:48 -05:00
parent 7542a81f5c
commit d6e8a18773
2 changed files with 23 additions and 1 deletions

View file

@ -1,4 +1,5 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-FileCopyrightText: 2021 Ladyada for Adafruit Industries
# SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import ssl

View file

@ -0,0 +1,21 @@
# SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
CircuitPython Simple Example for LC709203 Sensor
"""
import time
import board
from adafruit_lc709203f import LC709203F, PackSize
# Create sensor object, using the board's default I2C bus.
battery_monitor = LC709203F(board.I2C())
# Update to match the mAh of your battery for more accurate readings.
# Can be MAH100, MAH200, MAH400, MAH500, MAH1000, MAH2000, MAH3000.
# Choose the closest match. Include "PackSize." before it, as shown.
battery_monitor.pack_size = PackSize.MAH400
while True:
print("Battery Percent: {:.2f} %".format(battery_monitor.cell_percent))
print("Battery Voltage: {:.2f} V".format(battery_monitor.cell_voltage))
time.sleep(2)