Skip to content

Commit d6e8a18

Browse files
committed
Include LC709203 example.
1 parent 7542a81 commit d6e8a18

File tree

2 files changed

+23
-1
lines changed
  • CircuitPython_Templates

2 files changed

+23
-1
lines changed

CircuitPython_Templates/adafruit_io_cpu_temp_neopixel_color/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
1+
# SPDX-FileCopyrightText: 2021 Ladyada for Adafruit Industries
2+
# SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
23
# SPDX-License-Identifier: MIT
34
import time
45
import ssl
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""
4+
CircuitPython Simple Example for LC709203 Sensor
5+
"""
6+
import time
7+
import board
8+
from adafruit_lc709203f import LC709203F, PackSize
9+
10+
# Create sensor object, using the board's default I2C bus.
11+
battery_monitor = LC709203F(board.I2C())
12+
13+
# Update to match the mAh of your battery for more accurate readings.
14+
# Can be MAH100, MAH200, MAH400, MAH500, MAH1000, MAH2000, MAH3000.
15+
# Choose the closest match. Include "PackSize." before it, as shown.
16+
battery_monitor.pack_size = PackSize.MAH400
17+
18+
while True:
19+
print("Battery Percent: {:.2f} %".format(battery_monitor.cell_percent))
20+
print("Battery Voltage: {:.2f} V".format(battery_monitor.cell_voltage))
21+
time.sleep(2)

0 commit comments

Comments
 (0)