This is it so far...
I know this thread has somewhat died, but I am all of a sudden having trouble with this web app. It was correctly working for me last Sunday, but for some reason is no longer working and I cannot seem to figure out why. I am using it for something simple and very similar to @PaulRBās Weather Station; just using it to call some Spark.variable()s, which should be simple enough. The Remote-Spark code is generally unchanged, except for substituting my access token, my coreID, and variables that I am trying to retrieve. And, like I previously mentioned, this was working for me last weekend, but is not now. Is anyone else (that is using this code) experiencing similar problems?
FWIW, the Spark-Helper app is working just fine to call my Spark.variable()s, so I am totally stumped as to why Spark-Helper works but Remote-Spark does not. Any direction would be greatly appreciated.
Hi @kherman,
If youāre having trouble using an API helper, or the web IDE, make sure your access token hasnāt changed since the last time you used it. Sometimes itās also helpful to refresh the web IDE page, or log out and back in.
Otherwise, what kind of errors are you seeing? We also removed āTEMPORARY_allTypesā from the variable return format, so itās possible this code is expecting that to be present.
Thanks!
David
Hi @Dave
I did make sure that my access token had not changed; I even re-copy/pasted it directly from the Spark IDE as part of my troubleshooting. I have refreshed the page, restarted, and even tried 3 different browsers (IE, Chrome, and Comodo Dragon), in both Remote-Spark and Spark-Helper.
I donāt receive any errors at all from Remote-Spark API, just āāā in the respective variable boxes (which I believe means that itās not getting anything back).
I think you just identified the issue with the āTEMPORARY_allTypesā because, yes, the Remote-Spark code does use it. See below. I suppose I should try to hack the Spark-Helper API then, unless you have another workaround? The web app is rather important to my intended application (and web development is definitely not my strong area), so itās kind of a requirement to use a website based API.
function getVariable(variable, callback) {
var url = baseURL + coreID + "/" + variable + "?access_token=" + accessToken;
$.ajax({
url: url,
dataType: "json"
}).success(function(obj) {
console.log(obj);
(obj.coreInfo.deviceID && obj.coreInfo.deviceID == coreID) ? onMethodSuccess() : onMethodFailure((obj.error)?obj.error:"");
callback(obj.TEMPORARY_allTypes.number);
}).fail(function(obj) {
onMethodFailure();
});
}
In the meantime it's just a matter of replacing:
obj.TEMPORARY_allTypes.number
with something like:
obj.result
Thanks @BDub! Sorry we didn't give more notice about that change!
@BDub awesome! You already rock for putting up your Remote-Spark so we can all benefit from it in each of our projects! Your efforts are already GREATLY appreciated. At least I know now Iām not going crazyā¦
@Dave thanks for the quick solution. I will replace while also try to explore the reasoning. Iām in the process of trying to add jQuery to my toolchest of knowledge, so Iām sure that understanding will be helpful to me in the future.
Thanks! Youāre welcome @kherman
and⦠Remote-Spark repo updated. However I think there is a problem with reading variables right now, so I canāt confirm itās working. @Dave do you see this as well? Functions seem to work fine, but no joy on variables. Iām getting:
{
cmd: "VarReturn"
name: "read"
error: {
error: "Variable not found"
}
coreInfo: {
last_app: ""
last_heard: "2014-01-24T22:29:17.530Z"
connected: true
deviceID: "xxxxxxxx"
}
}
Hey @BDub,
Hmm, that error message is something new we added, but it should only show up when that variable isnāt available. Can you check your coreās info page and see what it returns?
https://api.spark.io/v1/devices/your_device_id?access_token=your_access_token
Thanks!
David
Hereās the code Iām running (which has been known good up til now):
And hereās the info page output:
{
"id": "xxxxxx",
"name": "Technobly1",
"variables": [],
"functions": [
"start",
"trunk",
"lock",
"unlock"
]
}
However, if I run this program:
// Create a variable that will store the temperature value
int temperature = 0;
bool state = 0;
void setup()
{
// Register a Spark variable here
Spark.variable("temp", &temperature, INT);
Spark.function("toggle", toggleLED);
// Connect the temperature sensor to A0 and configure it
// to be an input
pinMode(A0, INPUT);
pinMode(D7, OUTPUT);
}
void loop()
{
// Keep reading the temperature so when we make an API
// call to read its value, we have the latest one
temperature = analogRead(A0);
}
int toggleLED (String args) {
state = !state;
digitalWrite(D7,state);
}
Variables are working and I get this on my info page:
{
"id": "xxxxx",
"name": "Technobly1",
"variables": {
"temp": "int32"
},
"functions": [
"toggle"
]
}
Hmm, I just flashed your code to a Core with no changes, and hereās my output:
{
"id": "50ff70065067545628100587",
"name": "second-run",
"variables": {
"startstate": "int32",
"trunkstate": "int32",
"lockstate": "int32"
},
"functions": [
"start",
"trunk",
"lock",
"unlock"
]
}
so it looks like itās working for me⦠are you sure yours flashed correctly?
No, Iām not sure!
But it did flash, and reboot and connect to the cloud again. So it either worked, or it didnāt and reverted supposedly? Iāll try it at home here now and report back.
EDIT: Of course itās working now⦠-_- Not sure what went wrong or how to correct it though. 
BTW:
{
"btw": "234523457545628100587",
"don\'t": "aaaaaaaa",
"think": {
"i": "int32",
"didn\'t"": "int32",
"notice": "int32"
},
"your": [
"fancy",
"syntax",
"highlighting"
]
}
Damn straight. I guess weāll just pretend this little bug never happened, thenā¦
let us know if you run into it again
Thanks @Dave, that woked for my Weather Station page (updated).
Hi,
Does anyone have a clue about how to get the data from an slider out of the HTML type=ārangeā to the spark code analogWrite in THIS example?
Thanks,
Max
@Max2 I would think you just need to bind a hook to the Mouse Up state to read your slider value, and if itās different than the last call, send the new value to the Spark. You donāt want to be sending values as soon as they change because it would send way to many requests to the Cloud at once.
Just for Reference:
http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_type_range
Mouse Up:
http://api.jquery.com/mouseup/
There are probably even a million ways to do this with JQuery UI type stuff, but I kind of like the simplicity of the Range element. Let us know how it works out for you!
Hello,
I want to do a better visualization of the measured temperature. For it would be great to use these gauges.
ww.justgage.com
Does anyone know how to integrate these gauge in the application?
I want instead of the text-box to display the value in these gauges.
Does anybody can write a simple example?
Those are cool gauges @developer_bt
They are just simple javascript arc type stuff⦠the example HTML files that it comes with shows you how to use them if you look at the code in the HTML files. Iām currently creating an example with the Remote Spark app to use the gauges. Weāll see how it turns out!
Hello @BDub!
Itās really excellent!

I got something going, just working out the bugs⦠and the Sparkulator is particularly slow today⦠so thatās not helping.