Skip to content

Commit cd47073

Browse files
authored
Merge pull request #2400 from kattni/max17048-template-code
Add template code for MAX17048.
2 parents bdb50b7 + 18c63cb commit cd47073

File tree

1 file changed

+15
-0
lines changed
  • CircuitPython_Templates/max17048

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2023 Kattni Rembor for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
import time
6+
import board
7+
import adafruit_max1704x
8+
9+
monitor = adafruit_max1704x.MAX17048(board.I2C())
10+
11+
while True:
12+
print(f"Battery voltage: {monitor.cell_voltage:.2f} Volts")
13+
print(f"Battery percentage: {monitor.cell_percent:.1f} %")
14+
print("")
15+
time.sleep(1)

0 commit comments

Comments
 (0)