How to connect Device to the Server?

Hi,

I have purchased the cloud, and now I do not know how to connect my device to the new server cloud. I’m using NodeMCU ESP8266, and this below is my code:

#define THINGER_SERVER "myserver.aws.thinger.io"
#include <ESP8266WiFi.h>
#include <ThingerESP8266.h>

#define USERNAME "myusername"
#define DEVICE_ID "device_1" // nama device
#define DEVICE_CREDENTIAL "credentials1"

ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
const char* ssid = "myssid";
const char* password = "mypassword";

void setup() {
  Serial.begin(115200);
  thing.add_wifi(ssid, password);
  thing["dataSensor"] >> [](pson & out)
  {
    out["temperatur air"] = temperatur;
    out["turbiditas"] = turbidity;
    out["oksigen"] = oksigen;
    out["ph"] = phmeter;
  };
}

void loop() {
thing.handle();
}

The code is well compiled on Arduino IDE, the WiFi’s connection is good, but the device won’t connect on the cloud server.
Is there something that I missed?

Hi @yohanespb,

can you enable log to see what is happening? (https://docs.thinger.io/coding-guide#enabling-debug-output)

Hi @alvarolb ,

Thanks for your response!

I’ve managed to solve it by changing the THINGER_SERVER in <ThingerClient.h> library into my server name, then I did #include <ThingerClient.h> to my code. and It works now!

1 Like