Closed Cubox closed 4 years ago
Which version of the library is used? Which version of the IDE?
sensors.requestTemperatures(); normally blocks until a ready signal.
1) I see it is the first print statement. Can you add a print statement in setup - Serial.println("setup"); just to see print is working before the request call. I do not expect the problem to be there but excluding causes is important.
2) Comment these two lines -
#define REQUIRESALARMS false
#define REQUIRESNEW false
These two lines caused a lot of warnings when trying to compile your code
Markup trick: add cpp after the first three back quotes of your code block and you get syntax highlighting. Looks nicer and can help finding some errors.
```cpp
Seems this one that cause the compiler warnings
#define REQUIRESALARMS false
The versions of libraries:
|-- <DallasTemperature> 3.8.1
| |-- <OneWire> 2.3.5
I am using VSCode with PlatformIO, which compiles the code.
Alright, you found the issue. I commented both the REQUIRES defines, and it worked. Something there must be needed for the program to work as intended. Thanks, truly. I spent hours trying to find out WHY this would happen.
Looked into the lib code and my quick analysis is that you need to setup a handler if you #define REQUIRESALARM . It doesn't matter if you set it to false, it just checks if it is defined or not. By default it is set to NULL so if it is called an UNO does sort of warm reboot. YOu could verify this with a print statement in setup followed by a delay(100) to give some time to print the text.
if I use Serial.println in the setup() function, even without delay, it will print the message.
I'm having a very weird issue with the lib. I don't know if that an issue with the lib itself, but I would gladly appreciate the help. I have tried this behaviour with either only one DS18B20 or multiples. I'm using a Arduino Uno, with the following code:
This, for me, will hang at the requestTemperature, and never execute the Serial.println after it. If you remove the Serial.println line, the program works fine and the temperatures are listed fine.
I can't find why and it's turning me mad. I have checked the hardware side of things multiples times, tried to change the code more, but I could only reproduce the problem with that.
What the hell is happening?