Ah yes of course. I wasn't sure which wires i'd have to put additional resistors across, or this was even permissible. I could try that then.Roberthh wrote: ↑Wed Nov 09, 2022 1:33 pmYou can measure the existing pull-up resistors between a data line and Vcc, if the sensor is not powered. And you can always connect additional resistors fomr SDA to Vcc and SCL to Vcc. They would be simply in parallel to the existing resistor. Let's assume, the existing value is 4700, and you add 390 Ohm. Then the resulting value is 1 / ((1 / 4700) + (1 / 390)) = 360.
Any idea why my error "ex" from my code wont write into my errorlog.txt file? Only the 'Error:' part gets printed even though on the Thonny screen, I get the whole message of 'Error: Bus error' where 'Bus error' is "ex" in my code.
I also got my sensor reset to work (i think. The real test will be a real error instead of me entering a wrong i2c address for the sensor). I had to flash_nuke.uf2 my Pico W because it got into an irrecoverable reboot loop, which I then fixed with a 10 secs delay and a print to screen as a heads up that the Pico W is going to reboot. So my readsensor() funtion now looks like this:
Code: Select all
def readsensor():
global temperature
global humidity
try:
sensor = sht.measure()
except SHT30Error as ex:
sht_error(ex)
try:
print("resetting SHT30")
restartsensor = SHT30(i2c)
time.sleep(1)
restartsensor.reset()
time.sleep(2)
print("SHT30 reset")
sensor = sht.measure()
except:
print("rebooting Pico W")
time.sleep(10)
machine.reset()
temperature, humidity = sensor