@kidrock I just tried to create a test program that exposed a float variable and I got a compiler error. I don't think FLOAT is a supported type yet for Spark.variable().
Here's my code that didn't compile:
bool state = HIGH;
float floaty = 20.5;
void setup() {
pinMode(D7,OUTPUT);
digitalWrite(D7,HIGH); // turn on D7 by default
Spark.function("test", testFunction);
Spark.variable("floaty", &floaty, FLOAT);
}
int testFunction(String args) {
state = !state; // toggle the state
digitalWrite(D7,state);
return 200;
}
You could use a string to get your data through a GET request from Spark.variable() like wgbartley has done here:
You will receive back something like this currently:
{
"cmd": "VarReturn",
"name": "mystr",
"TEMPORARY_allTypes": {
"string": "20.25",
"uint32": 842018354,
"number": 842018354,
"double": null,
"raw": "20.25"
},
"result": "20.25",
"coreInfo": {
"last_app": "foo",
"last_heard": "2013-12-31T02:18:20.493Z",
"connected": false,
"deviceID": "098712304987123046761928"
}
}
GET request formatted like this:
https://api.spark.io/v1/devices/53ff6a065067544838360587/mystr?access_token=0826376570961234796129873409817245
which works in your browser address bar, once you put a valid access_token in