mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
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:
@ -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");
|
||||
}
|
||||
|
Reference in New Issue
Block a user