Hello. I have two similar codes. One is through my iphone as hotspot - works. Other one is through my wifi at home. Does not work. But it is connected to the wifi, because I can see it on serial monitor + I can ping that. What is the problem?
#include <ESP8266WiFi.h>
#include <ThingerESP8266.h>
/*
IPAddress ip(x,x,x,x);
IPAddress subnet(x,x,x,x);
IPAddress gateway(x,x,x,x);
*/
#define USERNAME "x"
#define DEVICE_ID "x"
#define DEVICE_CREDENTIAL "x"
ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
void setup()
{
Serial.begin(115200);
Serial.println();
WiFi.mode(WIFI_STA);
// WiFi.config(ip, gateway, subnet);
//WiFi.begin("wifi", "x");
WiFi.begin("iPhone", "x");
// thing.add_wifi("iPhone", "x");
//thing.add_wifi("wifi", "x");
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected, IP address: ");
Serial.println(WiFi.localIP());
//WiFi.printDiag(Serial);
//Serial.setDebugOutput(true);
thing["led"] << digitalPin(LED_BUILTIN);
thing["millis"] >> outputValue(millis());
}
void loop() {
thing.handle();
}