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
9bd9b6c4b2
...
12c25b33a7
Author | SHA1 | Date | |
---|---|---|---|
|
12c25b33a7 | ||
|
5b27974d5a | ||
|
f4ce50db18 |
@@ -1,5 +1,5 @@
|
||||
#include <DHT.h>
|
||||
|
||||
// define pins and type of DHT sensor
|
||||
#define DHTPIN 4
|
||||
#define DHTTYPE DHT11
|
||||
#define MQ5_PIN 2
|
||||
@@ -19,7 +19,7 @@ void loop() {
|
||||
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;
|
33
src/C++/Driver/src/TestM5.cpp
Normal file
33
src/C++/Driver/src/TestM5.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <M5Stack.h>
|
||||
#include <Wire.h>
|
||||
#include "Adafruit_SGP30.h"
|
||||
|
||||
Adafruit_SGP30 sgp;
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
Serial.begin(9600);
|
||||
|
||||
|
||||
if (!sgp.begin()) {
|
||||
Serial.println("SGP30 sensor niet gevonden :(");
|
||||
while (1);
|
||||
}
|
||||
Serial.println("SGP30 sensor gevonden!");
|
||||
|
||||
sgp.setIAQBaseline(0x8973, 0x8AAE);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
delay(1000);
|
||||
|
||||
if (!sgp.IAQmeasure()) {
|
||||
Serial.println("Error bij meting!");
|
||||
return;
|
||||
}
|
||||
Serial.print("eCO2: ");
|
||||
Serial.print(sgp.eCO2);
|
||||
Serial.print(" ppm\tTVOC: ");
|
||||
Serial.print(sgp.TVOC);
|
||||
Serial.println(" ppb");
|
||||
}
|
Reference in New Issue
Block a user