Hello everyone
I´m trying to make a project where the devices send 4 variables
client.add("temperatura", temp); //Insert your variable Labels and the value to be sent
client.add("humedad", hum);
client.add("temperaturaagua", watertemp);
client.add("ph",phvalue);
if i understodd properly it should work like this ( for sure i´m doing something wrong), the issue is that i can just publish two variables instead of 4, in the dasboard or device tab in ubidots i just see the update of two variables
PD: No matter if it is in educational or bussiness platform
Anyone can help ???
Thanks!!!
Code:
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
/****************************************
* Define Constants
****************************************/
#define TOKEN "A1E-I5kmo5adEl7XwTrIdYQA2XkrpPH0mX" // Your Ubidots TOKEN
#define WIFINAME "xxxxx" //Your SSID
#define WIFIPASS "xxxxx" // Your Wifi Pass
float temp;
float hum;
float watertemp;
float phvalue;
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.wifiConnection(WIFINAME, WIFIPASS);
client.begin(callback);
}
void loop() {
// put your main code here, to run repeatedly:
if(!client.connected()){
client.reconnect();
}
temp = random(1,70);
hum = random (1,100);
watertemp = random(1,50);
phvalue = random(1,9);
client.add("temperatura", temp); //Insert your variable Labels and the value to be sent
client.add("humedad", hum);
client.add("temperaturaagua", watertemp);
client.add("ph",phvalue);
delay(10000);
Serial.println("***********************************************************************************");
Serial.print("temperatura: ");
Serial.print(temp);
Serial.println(" ºC");
Serial.print("humedad: ");
Serial.print(hum);
Serial.println(" %");
Serial.print("temperatura del agua: ");
Serial.print(watertemp);
Serial.println(" ºC");
Serial.print("ph: ");
Serial.print(phvalue);
Serial.println(" ");
Serial.println("***********************************************************************************");
client.ubidotsPublish("proto");
client.loop();
}