formatting

This commit is contained in:
simonox 2022-12-30 11:37:35 +01:00
parent 68d6c19a78
commit 66be711123

View file

@ -4,7 +4,7 @@
DHTesp dht; DHTesp dht;
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200); // use this baud rate in serial monitor to see stuff
dht.setup(D0, DHTesp::DHT11); // Connect DHT sensor to D0 dht.setup(D0, DHTesp::DHT11); // Connect DHT sensor to D0
} }
@ -13,18 +13,16 @@ void loop() {
float humi = dht.getHumidity(); float humi = dht.getHumidity();
// read temperature in Celsius // read temperature in Celsius
float tempC = dht.getTemperature(); float tempC = dht.getTemperature();
// read soil // read soil
int soil = analogRead(AOUT_PIN); // read the analog value from sensor int soil = analogRead(AOUT_PIN); // read the analog value from sensor
// check whether the reading is successful or not // check whether the reading is successful or not
if (isnan(tempC) || isnan(humi)) { if (isnan(tempC) || isnan(humi)) {
Serial.println("Failed to read from DHT sensor!"); Serial.println("Failed to read from DHT sensor!");
} if (isnan(soil)) { } if (isnan(soil)) {
Serial.println("Failed to read from soil sensor!"); Serial.println("Failed to read from soil sensor!");
} else { } else {
Serial.print("Humidity: "); Serial.print("Humidity: ");
Serial.print(humi); Serial.print(humi);
Serial.print("%"); Serial.print("%");
@ -34,7 +32,9 @@ void loop() {
Serial.print("Temperature: "); Serial.print("Temperature: ");
Serial.print(tempC); Serial.print(tempC);
Serial.print(" C "); Serial.print(" C ");
Serial.print(" | "); Serial.print(" | ");
Serial.print("Moisture value: "); Serial.print("Moisture value: ");
Serial.println(soil); Serial.println(soil);