Skip to content

Commit 99bc0a0

Browse files
committed
Merge pull request #3294 from agdl/TemperatureWebPanelFix
Added literal float to improve precision
2 parents 0a6841d + 8a54c70 commit 99bc0a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libraries/Bridge/examples/TemperatureWebPanel/TemperatureWebPanel.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ void loop() {
9898
Serial.println(timeString);
9999
int sensorValue = analogRead(A1);
100100
// convert the reading to millivolts:
101-
float voltage = sensorValue * (5000 / 1024);
101+
float voltage = sensorValue * (5000.0f / 1024.0f);
102102
// convert the millivolts to temperature celsius:
103-
float temperature = (voltage - 500) / 10;
103+
float temperature = (voltage - 500.0f) / 10.0f;
104104
// print the temperature:
105105
client.print("Current time on the Yún: ");
106106
client.println(timeString);

0 commit comments

Comments
 (0)