I am new to ubidots and am using it for a school project and i am using the particle photon to communicate send variables to ubidots.
I am using the example code i found ( see link and code below) and it does what i want but after it creates a new variable i need to refresh the page in order for it to show up on the device.
Also if someone could tell me how to update variables instead of making new ones i would be grateful.
Link:
http://help.ubidots.com/connect-your-devices/connect-a-particle-device-to-ubidots
Code:
// This example is to get the last value of variable from the Ubidots API
// This example is to save multiple variables to the Ubidots API with TCP method
/****************************************
* Include Libraries
****************************************/
#include "Ubidots.h"
/****************************************
* Define Constants
****************************************/
#define TOKEN "Your_Token" // Put here your Ubidots TOKEN
Ubidots ubidots(TOKEN);
/****************************************
* Auxiliar Functions
****************************************/
//Put here your auxiliar functions
/****************************************
* Main Functions
****************************************/
void setup() {
Serial.begin(115200);
//ubidots.setDebug(true); //Uncomment this line for printing debug messages
}
void loop() {
float value1 = analogRead(A0);
float value2 = analogRead(A1);
float value3 = analogRead(A2);
ubidots.add("Variable_Name_One", value1); // Change for your variable name
ubidots.add("Variable_Name_Two", value2);
ubidots.add("Variable_Name_Three", value3);
ubidots.sendAll();
delay(5000);
}