Implement basic temperature and humidity sensor

This commit is contained in:
coolneng 2023-03-15 02:47:49 +01:00
parent d5dcb0cec5
commit 043753df16
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 14 additions and 3 deletions

View File

@ -1,9 +1,20 @@
#include <Arduino.h>
#include <DHT.h>
void setup() { Serial.begin(9600); }
#define DHTTYPE DHT11
#define DHTPIN 4
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
Serial.println("Sup dude");
delay(1000);
char buffer[100];
sprintf(buffer, "Temperature: %.2f °C Humidity: %.2f %%",
dht.readTemperature(), dht.readHumidity());
Serial.println(buffer);
delay(60000);
}