Added comments

This commit is contained in:
Yannick van Etten
2024-11-11 10:53:10 +01:00
parent 2e08bf7e74
commit 3525479b17

View File

@@ -7,24 +7,24 @@
DHT dht(DHTPIN, DHTTYPE);
void setup() {
//initialize serial communication and the sensors
Serial.begin(9600);
dht.begin();
pinMode(MQ5_PIN, INPUT);
}
void loop() {
delay(500);
float h = dht.readHumidity();
float t = dht.readTemperature();
int mq5Value = analogRead(MQ5_PIN);
// if sensor isn't connected properly display error message
if (isnan(h) || isnan(t)) {
Serial.println("Fout bij het lezen van de sensor!");
return;
}
// puts sensor values in the serial monitor
Serial.print("Luchtvochtigheid: ");
Serial.print(h);
Serial.print(" %\tTemperatuur: ");
@@ -33,4 +33,6 @@ void loop() {
Serial.print("MQ5 waarde: ");
Serial.println(mq5Value);
delay(500);
}