// LCD1602 and Pi Pico!
#include <DHT.h>
#include <LiquidCrystal.h>
int pin =3;
DHT dht(pin,DHT22);
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
void setup() {
lcd.begin(16, 2);
lcd.print("Hello SVECW!");
Serial.begin(115200);
Serial.print("DHT22 Example...");
dht.begin();
}
void loop() {
float temp =dht.readTemperature();
float humd =dht.readHumidity();
if(isnan(temp) || isnan(humd)){
Serial.println("Failed to read values from DHT sensor");
return;
}
lcd.setCursor(0,1);
lcd.print(temp);
lcd.print("\xdf");
lcd.print("C");
lcd.setCursor(10,1);
lcd.print(humd);
lcd.print("%");
Serial.print("Humidity : ");
Serial.print(humd);
Serial.print("% Temperature : ");
Serial.print(temp);
Serial.println("°C");
delay(1); // Adding a delay() here speeds up the simulation
}