// For : https://forum.arduino.cc/t/expected-or-before-void/1026499
//
// Changes:
// - added a semicolon after variable setTime=500
// - added a delay at the end of the loop()
// - improved the text layout
// - added the UTF-8 symbol for degrees
// - changed DHT11 to DHT22, because Wokwi has no DTH11
#include <DHT.h>
#define Type DHT22 // Wokwi only simulates the DHT22
int sensePin=2;
DHT HT(sensePin,Type);
float humidity;
float tempC;
float tempF;
int setTime=500;
void setup()
{
// put your setup code here, to run once:
Serial.begin(9600);
HT.begin();
delay(setTime);
}
void loop()
{
// put your main code here, to run repeatedly:
humidity = HT.readHumidity();
tempC = HT.readTemperature();
tempF = HT.readTemperature(true);
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" Temperature ");
Serial.print(tempC);
Serial.print(" °C ");
Serial.print(tempF);
Serial.println( " °F");
delay(1000);
}