Hello. Look, what I am trying to do is getting the aht20 sensor send information to adafruit io dashboard. But when I run the code, it says in the serial monitor "network disconnected"
// Adafruit IO Temperature & Humidity Example
// Tutorial Link: Overview | Adafruit IO Basics: Temperature & Humidity | Adafruit Learning System
//
// Adafruit invests time and resources providing this open source code.
// Please support Adafruit and open source hardware by purchasing
// products from Adafruit!
//
// Written by Todd Treece for Adafruit Industries
// Copyright (c) 2016-2017 Adafruit Industries
// Licensed under the MIT license.
//
// All text above must be included in any redistribution.
/************************** Configuration ***********************************/
// edit the config.h tab and enter your Adafruit IO credentials
// and any additional configuration needed for WiFi, cellular,
// or ethernet clients.
#include "config.h"
/************************ Example Starts Here *******************************/
#include <Adafruit_AHTX0.h>
Adafruit_AHTX0 aht;
// set up the 'temperature' and 'humidity' feeds
AdafruitIO_Feed *temperature = io.feed("temperature");
AdafruitIO_Feed *humidity = io.feed("humidity");
void setup() {
// start the serial connection
Serial.begin(115200);
// wait for serial monitor to open
while (! Serial);
// initialize dht22
aht.begin();
// connect to io.adafruit.com
Serial.print("Connecting to Adafruit IO");
io.connect();
// wait for a connection
while (io.status() < AIO_CONNECTED) {
Serial.print(io.statusText());
delay(500);
}
// we are connected
Serial.println();
Serial.println(io.statusText());
}
void loop() {
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data
Serial.print("Temperature: "); Serial.print(temp.temperature); Serial.println(" degrees C");
Serial.print("Humidity: "); Serial.print(humidity.relative_humidity); Serial.println("% rH");
delay(500);
}