Sparkfun ESP32 Thing with DS18b20 not working

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
kenglover
Posts: 1
Joined: Wed Jan 30, 2019 4:20 am

Sparkfun ESP32 Thing with DS18b20 not working

Post by kenglover » Wed Jan 30, 2019 4:41 am

Hello everyone,
Thanks for the great work on MicroPython.

I am trying to get temperature readings working using a ds18b20 using a Sparkfun ESP32 Thing board. It was working when using Arduino, but when I change over to MicroPythod it always returns 85 (indicates error).

I am using the most recent release v1.10 and have even tried building it myself from source.

My code is:
[code]
import time
import machine, onewire
import ds18x20

# the device is on GPIO19
dat = machine.Pin(19)

# create the onewire object
ds = ds18x20.DS18X20(onewire.OneWire(dat))

# scan for devices on the bus
roms = ds.scan()
print('found devices:', roms)

ds.convert_temp()
time.sleep_ms(750)
ds.read_temp(roms[0])
[/code]

Thanks
Ken

Post Reply