Criei um programa no IoT Cloud utilizando uma ESP8266 NodeMcu, consegui transferi o programa para a placa, mas a ESP8266 não conecta com o meu wifi.
As informações da rede estão certas no site, mas mesmo assim não conecta.
Eu fiz um teste com um programa simples no Arduino IDE usando a mesma rede wifi, e conectou normalmente. O problema está sendo apenas com o programa feito no IoT Cloud.
#include "thingProperties.h"
#include <DHT.h> //Biblioteca do DTH11
#define DHTTYPE DHT22
#define DHTPIN 5
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
pinMode(6, OUTPUT);
dht.begin();
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
leiturasensor();
// Your code here
}
/*
Since VENTILACAO is READ_WRITE variable, onVENTILACAOChange() is
executed every time a new value is received from IoT Cloud.
*/
void onVENTILACAOChange() {
// Add your code here to act upon VENTILACAO change
if (VENTILACAO == 1) {
digitalWrite(6, HIGH);
} else {
digitalWrite(6, LOW);
}
}
void leiturasensor() {
float t = dht. readTemperature();
float h = dht. readHumidity();
TEMPERATURA = t;
UMIDADE = h;
delay(1000);
}
O código é esse, mas ele não possui falhas, pois faz o download para a placa normalmente.
Alguém poderia me ajudar?