I was following the code in the example found here: https://learn.adafruit.com/adafruit-esp ... ry-3122383
But have added some code from the i2c page to prove that the address is listed in a scan: https://learn.adafruit.com/scanning-i2c ... cuitpython
The code I am currently running:
Code: Select all
import time
import board
from adafruit_lc709203f import LC709203F
i2c = board.I2C()
while not i2c.try_lock():
pass
try:
print(
"I2C addresses found:",
[hex(device_address) for device_address in i2c.scan()],
)
finally: # unlock the i2c bus when ctrl-c'ing out of the loop
i2c.unlock()
time.sleep(1)
sensor = LC709203F(board.I2C())
print("IC version:", hex(sensor.ic_version))
while True:
print(
"Battery: %0.3f Volts / %0.1f %%" % (sensor.cell_voltage, sensor.cell_percent)
)
time.sleep(1)
Code: Select all
I2C addresses found: ['0xb']
Traceback (most recent call last):
File "code.py", line 20, in <module>
File "adafruit_lc709203f.py", line 117, in __init__
ValueError: No I2C device at address: 0xb
Code done running.
Code: Select all
Traceback (most recent call last):
File "code.py", line 20, in <module>
File "adafruit_lc709203f.py", line 122, in __init__
File "adafruit_lc709203f.py", line 126, in init_RSOC
File "adafruit_lc709203f.py", line 247, in _write_word
OSError: [Errno 116] ETIMEDOUT