Add template code for MAX17048.
This commit is contained in:
parent
bdb50b7059
commit
18c63cb763
1 changed files with 15 additions and 0 deletions
15
CircuitPython_Templates/max17048/code.py
Normal file
15
CircuitPython_Templates/max17048/code.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# SPDX-FileCopyrightText: Copyright (c) 2023 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
import time
|
||||
import board
|
||||
import adafruit_max1704x
|
||||
|
||||
monitor = adafruit_max1704x.MAX17048(board.I2C())
|
||||
|
||||
while True:
|
||||
print(f"Battery voltage: {monitor.cell_voltage:.2f} Volts")
|
||||
print(f"Battery percentage: {monitor.cell_percent:.1f} %")
|
||||
print("")
|
||||
time.sleep(1)
|
||||
Loading…
Reference in a new issue