NodeMCU cannot connect to thinger


#1

Hey.

I have been facing problems with connecting my nodemcu to the thinger cloud… I am attaching the arduino code I am using and the output… Please help.

thinger code.cpp (2.3 KB)


#2

Same problem here. I have a Sparkfun Thing and an ESP12S module. Both running same code and both give same error:

#define _DEBUG_
#include <ESP8266WiFi.h>
#include <ThingerESP8266.h>

#define USERNAME xxxxxx
#define DEVICE_ID xxxxxx
#define DEVICE_CREDENTIAL xxxxxx

#define SSID xxxxxx
#define SSID_PASSWORD xxxxxx

ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
int ledPin = 4;       //LED
int buttonPin = 12;   //button
int buttonState = 0;

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT_PULLUP);
  Serial.begin(9600);
  thing.add_wifi(SSID, SSID_PASSWORD);
  thing["led"] << digitalPin(ledPin);  
  thing["button"] >> [](pson& out){
      out = buttonState;
  };
}

void loop() {
  buttonState = digitalRead(buttonPin);
  thing.handle();
  if (buttonState == 0) {   //button has been pressed
    delay(30);
    if (buttonState == 0) {   //button is still pressed
      thing.call_endpoint("button_press");
    }
  }
}

For ESP12S, I used board NodeMCU 0.9
For Thing, I used board Sparkfun Thing ESP8266 Dev

Following is the debug output:
[_SOCKET] Connecting to iot.thinger.io:25202
[_SOCKET] Using secure TLS/SSL connection: yes
[_SOCKET] Error while connecting!

This code was working flawlessly several months ago. No changes to router, etc. Has something changed on the platform?


#3

Hi guys, I’m running both codes but have no any problem.

I’m using Arduino IDE 1.8.5
ESP 8266 core v2.5.0 (beta3)
Thinger.io libraries v2.13.0

please make sure you are using the latest updates and you are using #define DEBUG to find connecction problems (@Pshruthi)

best


#4

Hey jtrinc26,
Sorry for the late reply, I am currently using the Arduino IDE v1.8.9, ESP8266 v2.4.2 and Thinger library v2.13.0. When I tried using the #define DEBUG as u suggested, I am not getting any output in the serial monitor, hence I do not know about the connection problems but I am assuming that my connection is strong.


#5

Have you started the serial port at the sketch’s setup?


#6

I think i did start the serial port… (I underlined the commands in the setup image)


#7

Your setup routine has mistakes, paste your whole sketch in the right way if you want to get better support.

You can open the example’s sketch and compare with yours to see what you should add in this stage of the sketch, for example, you don’t have to code wifi connection routines, thinger’s library has already coded.

I suggest you try with example’s sketch, to see if it can achieve connection, after that add your particular process routine to this sketch, this way is how I always start any thinger device’s code.

Hope this helps.


#8

@jtrinc26 - Apologies for the looooooong delay - crazyness. Thank you sir! I did not realize the library had been updated. Update fixed my problem.