Fix merge conflicts, make compute heat index default to Fahrenheit to not break old code that assumes default is Fahrenheit.

This commit is contained in:
Tony DiCola
2015-06-26 15:56:04 -07:00
3 changed files with 37 additions and 18 deletions

View File

@ -37,9 +37,9 @@ void loop() {
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);
// Check if any reads failed and exit early (to try again).
@ -48,9 +48,10 @@ void loop() {
return;
}
// Compute heat index
// Must send in temp in Fahrenheit!
float hi = dht.computeHeatIndex(f, h);
// Compute heat index in Fahrenheit (the default)
float hif = dht.computeHeatIndex(f, h);
// Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(t, h, false);
Serial.print("Humidity: ");
Serial.print(h);
@ -61,6 +62,8 @@ void loop() {
Serial.print(f);
Serial.print(" *F\t");
Serial.print("Heat index: ");
Serial.print(hi);
Serial.print(hic);
Serial.print(" *C ");
Serial.print(hif);
Serial.println(" *F");
}