Hi!
I am having issues using Cloud variable, they are not registering at all.
I use the following code:
#include <math.h>
char publishString[40];
unsigned long lastPlantMeasure;
int value;
void setup()
{
lastPlantMeasure = 0;
RGB.control(true);
RGB.color(255,0,0);
RGB.brightness(0);
measurePlant();
}
void measurePlant() {
lastPlantMeasure = millis();
value = analogRead(A0);
sprintf(publishString,"%d", value);
Spark.publish("plantv1", publishString);
if(Particle.variable("myPlantHumidityv1", value) == false) {
Spark.publish("message", "VARIABLE NOT REGISTERED");
};
}
void loop(void) {
if(millis() - lastPlantMeasure > 60000) {
measurePlant();
}
}
VARIABLE NOT REGISTERED is getting published every minute. Also if i query the device it’s reporting no cloud variables at all:
curl https://api.particle.io/v1/devices/{deviceID}\?access_token\={token}
{
"id": "{deviceID}",
"name": "particle-pinny",
"last_app": null,
"last_ip_address": "{myip}",
"last_heard": "2016-03-18T15:17:17.937Z",
"product_id": 6,
"connected": true,
"platform_id": 6,
"cellular": false,
"status": "normal",
"variables": {},
"functions": [],
"cc3000_patch_version": "wl0: Nov 7 2014 16:03:45 version 5.90.230.12 FWID 01-628c21c3"
}
I use 0.4.9 firmware.
What’s wrong?