update data sending format
This commit is contained in:
parent
83cb1cacd8
commit
30bdbf61ad
@ -25,17 +25,21 @@ void loop() {
|
||||
float temp = dht.readTemperature();
|
||||
float hum = dht.readHumidity();
|
||||
|
||||
String tempStr = "Temperature = " + String(temp) + " °C";
|
||||
String humStr = "Humidite = " + String(hum) + " %";
|
||||
// Check if values are usables
|
||||
if (isnan(temp) || isnan(hum)) {
|
||||
Serial.println("Failed to read from DHT sensor!");
|
||||
}
|
||||
else {
|
||||
String tempStr = "Temperature = " + String(temp) + " °C";
|
||||
String humStr = "Humidite = " + String(hum) + " %";
|
||||
|
||||
// Send to Bluetooth
|
||||
mySerial.println(tempStr);
|
||||
mySerial.println(humStr);
|
||||
|
||||
// Show on Serial Monitor (for debugging)
|
||||
Serial.println(tempStr);
|
||||
Serial.println(humStr);
|
||||
// Send to Bluetooth
|
||||
mySerial.println(String(temp) + ";" + String(hum));
|
||||
|
||||
// Show on Serial Monitor (for debugging)
|
||||
Serial.println(tempStr);
|
||||
Serial.println(humStr);
|
||||
}
|
||||
delay(10000);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user