// This example is to get the last value of variable from the Ubidots API
#include "Ubidots.h"
#define TOKEN "Your_Token_Here" // Put here your Ubidots TOKEN
#define DATA_SOURCE_NAME "Your_Data_Source_Name_Here" // Put here your Ubidots data source name
Ubidots ubidots(TOKEN);
void setup() {
Serial.begin(115200);
}
void loop() {
float value;
value = ubidots.getValueWithDatasource(DATA_SOURCE_NAME, "Name_Of_Your_Variable");
Serial.println(value);
delay(60000); // Delay of one minute
}
The “value = ubidots.getValueWithDatasource(DATA_SOURCE_NAME, "Name_Of_Your_Variable");” can’t get value from ubitdots, does anyone know what’s the solution to solve this problem??
Here is the screenshot for my code and putty program output is “0.0” for what I get from my “ubidots.getValueWithDatasource(DATA_SOURCE_NAME, "Name_Of_Your_Variable");”
Please be carefull this is your data source tag, are you sure that SWITCH is your data source tag, and the name of variable that you will get is this one
Thank you so much @Metavix for your help. I changed the “source name” to “source tag” it work perfectly. I’m getting value 5.0
But, why does it print out "
Client connected
Particle/1.1|LV|4cOonYcioTF2JgwHldR75bfOGYgh9X|36003d000247343339373536:onoff|end
Receiving TCP transaction of 4 bytes.
OK|5End of TCP transaction.End o
"
Can You please fix this in your newest version of library?
The entire data is a debug method to search if any user got a problem, it is better than show nothing. But if you prefer i could change that to show only the float response. Im happy to solve your problem, thank you so much for your patient