Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2#
3# SPDX-License-Identifier: Unlicense
4
5import time
6import board
7from adafruit_lc709203f import LC709203F
8
9print("LC709203F simple test")
10print("Make sure LiPoly battery is plugged into the board!")
11
12sensor = LC709203F(board.I2C())
13
14print("IC version:", hex(sensor.ic_version))
15while True:
16 print(
17 "Battery: %0.3f Volts / %0.1f %%" % (sensor.cell_voltage, sensor.cell_percent)
18 )
19 time.sleep(1)
Thermistor test¶
Example showing the use of thermistors over I2C
1# SPDX-FileCopyrightText: 2021 Daniel Griswold
2#
3# SPDX-License-Identifier: MIT
4
5import time
6import board
7from adafruit_lc709203f import LC709203F
8
9print("LC709203F thermistor test")
10print("Make sure a thermistor is connected to the board!")
11
12sensor = LC709203F(board.I2C())
13
14# check your NTC thermistor datasheet for the appropriate B-Constant
15sensor.thermistor_bconstant = 3950
16sensor.thermistor_enable = True
17
18print("IC version:", hex(sensor.ic_version))
19while True:
20 print("Cell Temperature: %0.2f C" % (sensor.cell_temperature))
21 time.sleep(1)