2 Commits

Author SHA1 Message Date
Yannick van Etten
3525479b17 Added comments 2024-11-11 10:53:10 +01:00
Yannick van Etten
2e08bf7e74 Removed baseline 2024-11-11 09:19:08 +01:00
2 changed files with 5 additions and 5 deletions

View File

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

View File

@@ -14,8 +14,6 @@ void setup() {
while (1); while (1);
} }
Serial.println("SGP30 sensor gevonden!"); Serial.println("SGP30 sensor gevonden!");
sgp.setIAQBaseline(0x8973, 0x8AAE);
} }
void loop() { void loop() {