Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between ds18b20_get_temp() and ds18b20_getTempC() #13

Open
TimofeyPro opened this issue Mar 10, 2023 · 0 comments
Open

Difference between ds18b20_get_temp() and ds18b20_getTempC() #13

TimofeyPro opened this issue Mar 10, 2023 · 0 comments

Comments

@TimofeyPro
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant