formatting
This commit is contained in:
parent
68d6c19a78
commit
66be711123
|
@ -4,7 +4,7 @@
|
|||
DHTesp dht;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -13,18 +13,16 @@ void loop() {
|
|||
float humi = dht.getHumidity();
|
||||
// read temperature in Celsius
|
||||
float tempC = dht.getTemperature();
|
||||
|
||||
|
||||
// read soil
|
||||
int soil = analogRead(AOUT_PIN); // read the analog value from sensor
|
||||
|
||||
|
||||
// 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!");
|
||||
} if (isnan(soil)) {
|
||||
Serial.println("Failed to read from soil sensor!");
|
||||
} else {
|
||||
|
||||
Serial.print("Humidity: ");
|
||||
Serial.print(humi);
|
||||
Serial.print("%");
|
||||
|
@ -34,7 +32,9 @@ void loop() {
|
|||
Serial.print("Temperature: ");
|
||||
Serial.print(tempC);
|
||||
Serial.print(" C ");
|
||||
|
||||
Serial.print(" | ");
|
||||
|
||||
Serial.print("Moisture value: ");
|
||||
Serial.println(soil);
|
||||
|
||||
|
|
Loading…
Reference in a new issue