I am using a Raspberry Pi Pico W with a temperature sensor among other things. I tried finding code online to make the temperature sensor work and it returns the following error.
Found DS devices:  Traceback (most recent call last): File "<stdin>", line 14, in <module> File "ds18x20.py", line 1, in convert_temp File "onewire.py", line 1, in reset OneWireError:
This is my code, does anyone know what is going wrong?
import machine, onewire, ds18x20, time from machine import Pin led = Pin(15, Pin.OUT) button = Pin(14, Pin.IN, Pin.PULL_DOWN) ds_pin = machine.Pin(16) ds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin)) roms = ds_sensor.scan() print('Found DS devices: ', roms) while True: ds_sensor.convert_temp() time.sleep_ms(70) for rom in roms: print(rom) print(ds_sensor.read_temp(rom)) time.sleep(5) if button.value()==0: led.on() print('Door is open!') time.sleep(1) else: led.off() print('Door is closed!') time.sleep(1)
Thanks for reading. I don't have indent errors that might just be the StackExchange formatting.