mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-05 12:54:57 +00:00
Compare commits
3 Commits
db8758e1e5
...
bcbd6743fb
Author | SHA1 | Date | |
---|---|---|---|
|
bcbd6743fb | ||
|
9997bf2319 | ||
|
0ae0b83e4b |
@@ -1,16 +1,28 @@
|
||||
#include <DHT.h>
|
||||
#include <Wire.h>
|
||||
#include "Adafruit_SGP30.h"
|
||||
|
||||
Adafruit_SGP30 sgp;
|
||||
|
||||
// define pins and type of DHT sensor
|
||||
#define DHTPIN 4
|
||||
#define DHTTYPE DHT11
|
||||
#define MQ5_PIN 2
|
||||
#define SDA_PIN 10
|
||||
#define SCL_PIN 11
|
||||
|
||||
DHT dht(DHTPIN, DHTTYPE);
|
||||
|
||||
void setup() {
|
||||
//initialize serial communication and the sensors
|
||||
Serial.begin(9600);
|
||||
|
||||
dht.begin();
|
||||
|
||||
pinMode(MQ5_PIN, INPUT);
|
||||
|
||||
Wire.begin(SDA_PIN, SCL_PIN);
|
||||
Serial.println("SGP30 test");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
@@ -24,6 +36,12 @@ void loop() {
|
||||
Serial.println("Fout bij het lezen van de sensors!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (! sgp.IAQmeasure()) {
|
||||
Serial.println("Measurement failed");
|
||||
return;
|
||||
}
|
||||
|
||||
// puts sensor values in the serial monitor
|
||||
Serial.print("Luchtvochtigheid: ");
|
||||
Serial.print(h);
|
||||
@@ -34,5 +52,8 @@ void loop() {
|
||||
Serial.print("MQ5 waarde: ");
|
||||
Serial.println(mq5Value);
|
||||
|
||||
Serial.print("TVOC "); Serial.print(sgp.TVOC); Serial.print(" ppb\t");
|
||||
Serial.print("eCO2 "); Serial.print(sgp.eCO2); Serial.println(" ppm");
|
||||
|
||||
delay(500);
|
||||
}
|
@@ -1,3 +1,5 @@
|
||||
// Test code is merged to main sensor code os this file is not needed anymore
|
||||
|
||||
#include <Wire.h>
|
||||
#include "Adafruit_SGP30.h"
|
||||
|
||||
|
Reference in New Issue
Block a user