2

Good day,

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.

1 Answer 1

5

Your sensor can not be found, this is what is going wrong. Check the connections. Without further information it is not possible to answer why it is not found.

1
  • Yes thank you, I accidentally connected it to GPIO 18 instead of ground. This was the error. Commented Oct 17, 2022 at 9:45

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.