I2C bus error pytrack read_battery_voltage()
-
The pytrack regularly gives an i2c bus error when reading the battery voltage with the function "read_battery_voltage ()".
The firmware of the pytrack read out with "read_fw_version ()" returns 8The information about the version of the pyncom that I retrieve with "os.uname ()" is:
[0] LoPy4
[1] LoPy4
[2] 1.17.5.b6
[3] v1.8.6-849-56d00234 on 2018-05-18
[4] LoPy4 with ESP32
[5] 1.0.2 -
@chvl
I have the same issue with bus errors on battery read so I use a 'try' 'except' to catch the error and I limit my battery check to something reasonable - like every 10 minutes
eg:batt_check_interval = 600 # check the battery voltage every 10 minutes def readBattery(): global vBatt global last_batt_check global batt_check_interval if(utime.time() - last_batt_check > batt_check_interval): try: vBatt = pytrack.read_battery_voltage() # keep track of time since last battery check last_batt_check = utime.time() print ('Battery read: ' + str(vBatt)) if (vBatt < lowBatt): # do more here print ('Battery voltage: LOW') except Exception as e: print ('Battery read: ERROR') return return
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login