Videos:
Read moreHere are my videos on getting this set up:
Note that I am new to Firebase so they might be internal errors in the app. Tell me if you spot any.Testing DHT22
Run code and build circuit:
//Code
#include "DHT.h"
#define DHTPIN 6
DHT dht;
#define DHTTYPE DHT22 //Change this to any type of DHT Sensor you're Using!
DHT(DHTPIN, DHTTYPE);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); //Starts serial
delay(5000); //Waits before reading from sensor
Serial.println("DHT22 Temp. And Humi. Test"); //Prints the intro
}
void loop() {
// put your main code here, to run repeatedly:
dht.read11(DHTPIN); //Reads from the sensor
Serial.println("Humi. ---------- "); //Prints humidity
Serial.print(DHT.humidity); //Prints humidity
Serial.print("% "); //Marks the humidity as %
Serial.print("Temp. ------------ "); //Prints temperature
Serial.print(DHT.temperature); //Prints temperature
Serial.print("℃"); //Marks the temperature unit
Serial.println();
Serial.print("***********************************");
Serial.println)
delay(2000); //fastest is onceevrey 2 seconds
} //end loop
It should be printing temperature and humidity. If not check the buad rate. Change it to 9600. If it still does not work, this code will print "Hello World!" evrey second to see if you are getting any comunication at all:
//Code
void setup() {
Serial.begin(9600);
delay(5000);
}
void loop() {
Serial.println("Hello World!");
delay(1000);
}
Comments