mirror of
https://github.com/adafruit/DHT-sensor-library.git
synced 2023-10-23 22:20:38 +03:00
Improve output formatting in examples
This commit is contained in:
@ -25,7 +25,7 @@ DHT dht(DHTPIN, DHTTYPE);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
Serial.println("DHTxx test!");
|
||||
Serial.println(F("DHTxx test!"));
|
||||
|
||||
dht.begin();
|
||||
}
|
||||
@ -44,7 +44,7 @@ void loop() {
|
||||
|
||||
// Check if any reads failed and exit early (to try again).
|
||||
if (isnan(h) || isnan(t) || isnan(f)) {
|
||||
Serial.println("Failed to read from DHT sensor!");
|
||||
Serial.println(F("Failed to read from DHT sensor!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -53,17 +53,15 @@ void loop() {
|
||||
// Compute heat index in Celsius (isFahreheit = false)
|
||||
float hic = dht.computeHeatIndex(t, h, false);
|
||||
|
||||
Serial.print("Humidity: ");
|
||||
Serial.print(F("Humidity: "));
|
||||
Serial.print(h);
|
||||
Serial.print(" %\t");
|
||||
Serial.print("Temperature: ");
|
||||
Serial.print(F("% Temperature: "));
|
||||
Serial.print(t);
|
||||
Serial.print(" *C ");
|
||||
Serial.print(F("°C "));
|
||||
Serial.print(f);
|
||||
Serial.print(" *F\t");
|
||||
Serial.print("Heat index: ");
|
||||
Serial.print(F("°F Heat index: "));
|
||||
Serial.print(hic);
|
||||
Serial.print(" *C ");
|
||||
Serial.print(F("°C "));
|
||||
Serial.print(hif);
|
||||
Serial.println(" *F");
|
||||
Serial.println(F("°F"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user