mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-05 12:54:57 +00:00
rewrote DHT11 code
This commit is contained in:
@@ -1,23 +1,29 @@
|
||||
#include "DHT.h"
|
||||
#define DHT11PIN 4
|
||||
#include <DHT.h>
|
||||
|
||||
DHT dht(DHT11PIN, DHT11);
|
||||
void setup()
|
||||
{
|
||||
#define DHTPIN 4
|
||||
#define DHTTYPE DHT11
|
||||
|
||||
DHT dht(DHTPIN, DHTTYPE);
|
||||
|
||||
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 ");
|
||||
void loop() {
|
||||
delay(500);
|
||||
|
||||
float h = dht.readHumidity();
|
||||
float t = dht.readTemperature();
|
||||
|
||||
if (isnan(h) || isnan(t)) {
|
||||
Serial.println("Fout bij het lezen van de sensor!");
|
||||
return;
|
||||
}
|
||||
|
||||
Serial.print("Luchtvochtigheid: ");
|
||||
Serial.println(Humidity);
|
||||
delay(1000);
|
||||
Serial.print(h);
|
||||
Serial.print(" %\tTemperatuur: ");
|
||||
Serial.print(t);
|
||||
Serial.println(" *C");
|
||||
}
|
Reference in New Issue
Block a user