mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-05 12:54:57 +00:00
Code toegevoegd voor de DHT11 sensor
This commit is contained in:
23
src/C++/Driver/src/Sensors.h
Normal file
23
src/C++/Driver/src/Sensors.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include "DHT.h"
|
||||||
|
#define DHT11PIN 4
|
||||||
|
|
||||||
|
DHT dht(DHT11PIN, DHT11);
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
|
||||||
|
Serial.begin(9600);
|
||||||
|
/* Start the DHT11 Sensor */
|
||||||
|
dht.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
float Humidity = dht.readHumidity();
|
||||||
|
float Temperature = dht.readTemperature();
|
||||||
|
Serial.print("Temperatuur: ");
|
||||||
|
Serial.print(Temperature);
|
||||||
|
Serial.print("ºC ");
|
||||||
|
Serial.print("Luchtvochtigheid: ");
|
||||||
|
Serial.println(Humidity);
|
||||||
|
delay(1000);
|
||||||
|
}
|
Reference in New Issue
Block a user