#include <DHT_U.h>
#include <AdafruitIO_WiFi.h>
#include "config.h"
#define WIFI_SSID "Wokwi-GUEST"
#define WIFI_PASS ""
DHT_Unified dht(23, DHT22);
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);
AdafruitIO_Feed *temperature = io.feed("Fahrenheit Temperature");
AdafruitIO_Feed *relative_humidity = io.feed("Percentage Humidity");
void setup() {
Serial.begin(115200);
// Start DHT sensor
dht.begin();
// Starts Adafruit connection
io.connect();
// Waits until connection to Adafruit is made
while(io.status() < AIO_CONNECTED){
Serial.print('.');
delay(500);
}
// Outputs the connection status
Serial.println(io.statusText());
}
void loop() {
io.run();
// Create variable to store sensor data
sensors_event_t event;
// Fetch the temperature data
dht.temperature().getEvent(&event);
// Store the celsius temperature
float celsius = event.temperature;
// Convert the celsius temperature to fahrenheit
float fahrenheit = (celsius * 1.8) + 32;
//temperature->save(fahrenheit);
// Fetch the humidity data
dht.humidity().getEvent(&event);
// Store the humidity data
float humidity = event.relative_humidity;
Serial.println(humidity);
//relative_humidity->save(humidity);
// Create a five second delay
delay(10000);
}