feelfreelinux / ds18b20 Goto Github PK
View Code? Open in Web Editor NEWLibrary for single DS18B20 on ESP32 esp-idf framework
License: MIT License
Library for single DS18B20 on ESP32 esp-idf framework
License: MIT License
Hi there
Thanks for the simple library
Can it be used to 1 wire communication?
when it goes first while then numberFound = 1,but the secode while set numberFound = 0,so numberFound always no be 2;
my solution is clear numberFound = 0(line 26)
the result is :
Temperatures: 80.6F 80.6F
Temperatures: 27.0C 27.0C
Temperature: 27.0C
// search for 2 addresses on the oneWire protocol
while (search(tempSensorAddresses[numberFound],true)) {
numberFound++;
if (numberFound == 2) break;
}
// if 2 addresses aren't found then flash the LED rapidly
while (numberFound != 2) {
numberFound = 0;
if you have a good idea for solve this problem please tell me. thank you every much
Hi, first off, thanks for the work. Much appreciated.
I have used your library on an open source project and before I post it to github I would like to know what is the license.
best regards,
Hey there,
might be an absolute stupid question, but what is the purpose of the
system_init()
in your example https://github.com/feelfreelinux/myesp32tests/blob/master/examples/ds18b20_temperature.c ?
Building it, i get an error because there is no definition found for that function.
Maybe the example is a little outdated?
I removed system_init()
but don't know if that was correct since i still get no temperature and see no action on the GPIO when checking with my oscilloscope. Anyway, building is possible now.
In addition to that, is it correct to substitute
DS_init(DS_PIN)
by ds18b20_init(DS_PIN)
and
DS_get_temp()
by ds18b20_get_temp()
?
Thanks man, i'd realy be happy if you coul'd have a look on it :-)
Hello,
I am using your code in a simple project of mine. While doing so, I notice that every once in a while the temperature reading is incorrect. My guess is that it has something to do with the task scheduler switching tasks during one-wire communication. I fixed this by filtering out these measurements, but that is more of a workaround than a proper fix.
Have you noticed this behaviour?
I have just checked, but I don't have an extra sensor, I will order some, but it will take some time to arrive.
Hi there.
Sorry for the noobie question and the poor english, but could you tell me how can I write to the DS18B20 registers with this library? Such as set the alarm, check the address and so. Reading the temperature is cool, but the datasheet says that this little guy is able to do more!
Thanks!
Hi,
Code works great for 1 sensor.
I'm wanting to add a second sensor but run it off a separate GPIO.
How would you recommend going about this?
Thanks
Could you please explain why there is a difference in temperature values between ds18b20_get_temp() and ds18b20_getTempC()?
My question is related to the following part of the code from main.c file:
while (1) {
ds18b20_requestTemperatures();
float temp1 = ds18b20_getTempF((DeviceAddress *)tempSensors[0]);
float temp2 = ds18b20_getTempF((DeviceAddress *)tempSensors[1]);
float temp3 = ds18b20_getTempC((DeviceAddress *)tempSensors[0]);
float temp4 = ds18b20_getTempC((DeviceAddress *)tempSensors[1]);
printf("Temperatures: %0.1fF %0.1fF\n", temp1,temp2);
printf("Temperatures: %0.1fC %0.1fC\n", temp3,temp4);
float cTemp = ds18b20_get_temp();
printf("Temperature: %0.1fC\n", cTemp);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
Example of my output in console:
Temperatures: 78.8F 77.9F
Temperatures: 26.0C 25.5C <====== ds18b20_getTempC()
Temperature: 24.0C <====== ds18b20_get_temp()
The example was tested on ESP32-WROOM-32E using ESP-IDF v5.0.1
If the application requires the use of both libraries, there will be errors at compile time due to conflicting names of functions. Currently I have this set up to work by changing the names to add "ds_" prefixes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.