/*How to use the DHT-22 sensor with arduino uno
temperature and humidity sensor in wokwi*/
//Libraries
#include <DHT.h>;
//Constants
#define DHTPIN 7 //what pin we are connected to
#define DHTTYPE DHT22 //DHT 22 AM2302
DHT dht(DHTPIN,DHTTYPE);//Initialize DHT sensor for normal 16MHz Arduino
//variables
int chk;
float hum; //stores Humidity value
float temp; //Stores Temperature value
void setup()
{
Serial.begin(9600);
dht.begin();
}
void loop()
{
delay(2000);
//Read data and store it to variable hum and temp
hum=dht.readHumidity();
temp=dht.readTemperature();
//print temp and humidity values to serial monitor
Serial.print("Humidity: ");
Serial.print(hum);
Serial.print("% Temp: ");
Serial.print(temp);
Serial.print("Celsius");
delay(10000);//Delay by 2Sec
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
dht1:VCC
dht1:SDA
dht1:NC
dht1:GND