Incorrect reading of ds18b20

Uploading: image.png…
ds18b20 is connected correctly. The “ds18b20-thermometer” reads the temperature correctly as well. “get-address” reads the address correctly. Everything works fine on the Ardunio IDE. Reads the address and gives the correct temperature. Whereas “get-temp-c” gives the temperature -127, and “ds18b20-thermometer” at the same time 22.
Where is the bug?

I’ve added “get-temp-f” and everything is fine.

Hi @metagospek ,

You have used two different libraries for the ds18b20 and I think this is the cause of the unexpected behaviour.

If each ds18b20 sensor is connected to a different pin on your arduino, then you can use the ds18b20-thermometer node found in the builtin common-hardware library. The same node also appears in Victor’s ds18b20 library. This is the simplest way to use the ds18b20, because you don’t need to know the addresses of the devices.

If multiple ds18b20 sensors are attached to a single pin on your arduino, then you can use my ds18b20 library, which allows you to specify the address of the sensor you would like to read. For more information, please see Multiple DS18B20 Thermometers on Single OneWire Bus - #6 by wayland

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.