Stap 3: Schets voor de Arduino
#include "DHT.h"
#define DHTPIN 30
int sensorPin = A0;
unsigned int sensorValue = 0;
#define DHTTYPE DHT11
DHT dht (DHTPIN, DHTTYPE);
VOID Setup {}
Serial.begin(115200);
DHT.begin();
}
void loop {}
zweven h = dht.readHumidity();
zweven t = dht.readTemperature();
sensorValue = analogRead(sensorPin);
Als (isnan(t) || isnan(h) || h == 0) {}
Serial.Print("\n");
} else {}
Serial.Print ("vochtigheid:");
Serial.Print(h);
Serial.Print("%\n");
Serial.Print ("temperatuur:");
Serial.Print(t);
Serial.Print ("* C\n");
}
Serial.Print ("bodem vochtigheid:");
Serial.Print (float (sensorValue) / 1024 * 100, 0);
Serial.Print("%\n\n");
delay(500);
}