Hi, i am using the OneWire Library. The sensor works great, but in the library on some points there are delays. Although i power the sensor in non-parasitic mode, there are still delays necessary. i do not need very fast measuring intervals (e.g. 3000ms is enough).
is there a non-blocking type of library for this sensor out there (which works like the "blink without delay" - example)?
How much delay is allowed ?
5us ? 480us ?
If half-a-millisecond is not allowed, why not ?
What about disabling interrupts ? Is that allowed.
I needed fast other interrupts in a project, so I removed the disabling of the interrupts. But then I have to try 10 times to read it, and once in a while (once in a few weeks) the 10 times still fail.
After the DS18B20 is started, about 1 second is waited in the highest resolution. That delay can easily be avoided.
I would use millis() to create a block in the code that runs every second. At second '0' I would start the DS18B20, and at second '1' I would read it. And so on. It will be like a background task running every second.
Yes, thats the library, and i tried its sample code. i tried to avoid writing my own code, because i never used a onWire sensor so far.
you mentiond exactly the way i want to do it, but i thought i could just modify the library. is it complicated writing my own function for calling and reading the sensor in my millis()-block? os there a sample code just for starting and reading the sensor?
The OneWire library comes with a few examples, one for normal temperature reading of the DS18B20. In that example you can see that it is started and after that a delay of 1000ms.
When you installed the OneWire library properly, you can find its examples in the menu of the Arduino IDE.
thank you, your hint was very helpful:-)
i already had a look at m. burtons library, but i din't look at the "WaitForConversion2" - example, and thats EXACTLY what i meant. i am glad that i do not have to implement the setWaitForConversion() - function by my own:-))