We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Well, I must be pretty thick. Ive spent days searching the web but the entry barrier for getting json data into processing.js seems pretty high. I cant make head nor tail of the examples given in pomax's guide
http://processingjs.org/articles/PomaxGuide.html
I could really use a very simple paired down bit of example code for how to grab two fields from api.thingspeak.com using JSON and pass them to some function in a processing.js script then just write them either to println or the screen
POMAX's guide I find has two many ancillary bits to it. I dont want html button or for the user to have to click
I am just after something like this psuedocode
<HTML>
<SCRIPT>
If it been 4 seconds
{
grab new JSON Object from http://api.thingspeak.com/channels/5384/feed/last.json
Pass it to function in processing.js
}
</SCRIPT>
<HTML>
And for the processing.js side
setup()
{
etc etc
}
draw()
{
display_data;
}
display_data
{
println data
}
Would anyone care to take a bash at knocking up the worlds simplest example?
Answers
Have you read the whole guide? I see it has a section explaining how Processing can call a JavaScript function. The Json section shows a JS function getting data from a site. Just combine the two techniques, and you are good to go.
Yes Ive read it and im ashamed to say im a bit thick. I just cant get my head around it
BUMP. I've tried and tried and tried but i'm getting nowhere. any help on the above would be appreciated. I've spent a ridiculous amount of time just trying to get any sort of paired down code to get a couple of fields from thingspeak into processing.js and println them. I simply cannot get my head around the complexity of pomax's "guide" and I can't find anything else anywhere online