Hello,
I find an issue regarding switch widget I setup from dashboard that doesn’t given any response to my serial monitor nodemcu esp8266. Previously I don’t find any problem using ubidots education profile but when I use ubidots STEM profile this issue happen. The code that I use is the same how I use in ubidots education profile as the example given:
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
/****************************************
* Define Constants
****************************************/
#define TOKEN "" // Your Ubidots TOKEN
#define WIFINAME "" //Your SSID
#define WIFIPASS "" // Your Wifi Pass
#define DEVICE_LABEL "switch" //assig device variable
#define VARIABLE_LABEL "button" //assign variable
Ubidots client(TOKEN);
/****************************************
* Auxiliar Functions
****************************************/
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();
}
/****************************************
* Main Functions
****************************************/
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
client.ubidotsSetBroker("industrial.api.ubidots.com");
client.setDebug(true); // Pass a true or false bool value to activate debug messages
client.wifiConnection(WIFINAME, WIFIPASS);
client.begin(callback);
client.ubidotsSubscribe(DEVICE_LABEL,VARIABLE_LABEL); //Insert the dataSource and Variable's Labels
}
void loop() {
// put your main code here, to run repeatedly:
if(!client.connected()){
client.reconnect();
client.ubidotsSubscribe(DEVICE_LABEL,VARIABLE_LABEL); //Insert the dataSource and Variable's Labels
}
client.loop();
}