Stalls at client.wifiConnection(“TP-LINK_D22080”, “1234567”);


#1

Code stalls at client.wifiConnection(“TP-LINK_D22080”, “1234567”);
using nodemcu v3 esp8266 lolin
code listed below

#include <UbidotsESPMQTT.h>
#include <PubSubClient.h>
#define TOKEN "A1E-xxxxxxxxxxxxxxxx" // Your Ubidots TOKEN
Ubidots client(TOKEN);
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(sensor, INPUT);   // Analog pin setup for read
  pinMode(LED, OUTPUT);     // LED pin as output.
  client.setDebug(true);    // Pass a true or false bool value to activate debug messages
  client.wifiConnection("TP-LINK_D22080", "1234567");
  //client.wifiConnection(WIFINAME, WIFIPASS);
  client.begin(callback); 
  digitalWrite(LED, HIGH);           // turn the LED off.
  delay(10000);  
}

void callback(char* topic, byte* payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  for (int i = 0; i < length; i++) {
    Serial.print((char)payload[i]);
  }
  Serial.println();
}

#2

Dear @blueminerals,

As first to discard hardware issues, I recommend you make a test with the WebClient example provided in the ESP8266WiFi Library. Then, if you are able to establish the connection and handle the request, refer to followings codes based on your Ubidots License and take them as an example for your test. Don’t forget to replace the parameters where is indicated.

All the best,
Maria C.


#3

The code you referred me to is practically identical to my code. Your code doesb’t work either. I can get the Led to blink if I comment the client.wifiConnection line out. So the esp8266 executes code. Any other way to test the wifi?


#4

…reconnect
state: 2 -> 0 (0)
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 4
cnt
…state: 5 -> 2 (2c0)
rm 0


#5

Did you already try the WebClient example from ESP8266WiFi library?