Moors7
June 27, 2015, 7:36pm
3
Basically, you don't. Requesting variables is a GET request, which is what your browser does. Calling a function is a POST request, which your browser doesn't do.
Some more threads on this (the search function does wonders ;)):
I am new to Spark (but have had some experience with Arduino) and was trying out the “Control LEDS over the 'net” example. I successfully uploaded the code from the example (see below) and tryed typing in Terminal POST /v1/devices/{myDeviceIDHere}/led but instead of doing something to the LED (they don’t make it too clear what the example is actually supposed to do) I am just prompted with -bash: POST: command not found
Here is the code:
int led1 = D0;
int led2 = D6;
// This routine runs only…
I am working through CONTROL LEDS OVER THE ‘NET example right now. I can get it to work using cURL from Cygwin (I’m on a Windows 7 PC). I thought I’d be able to access the REST API directly from my browser, but I am getting an "access token not found error. I’m assuming my URL (below) is malformed. Is it possible to access the REST API from the browser? If so, can someone tell me what I’m doing wrong.
https://api.spark.io/v1/devices/MyDeviceID/led/access_token=MyAccessToken&args=l1%2CHIGH
Than…
Just trying out the core for the first time and was wondering if you can do the “CONTROL LEDS OVER THE ‘NET” example but with a wed browser url instead of the command prompt?
“curl https://api.spark.io/v1/devices/0123456789abcdef01234567/led
-d access_token=1234123412341234123412341234123412341234
-d params=l1,HIGH”
If I can then I could code it in html, flash, ect… typing out the id’s in the command prompt is a pain!
Hi all, I have been reading through the documentation (Cloud API, Firmware, Annotated examples sections) but there’s still a big piece of the jigsaw missing for me personally. I guess this is one of those areas of knowledge I am a beginner in, because I feels like everyone else talks about it like everybody knows it and it doesn’t need explaining. I can write basic HTML and even a little simple javascript (e.g for validating values entered on a web form).
Lets take the “Measuring the Temperatur…
I’ve looked at the Spark documentation and as usual it’s written for people who already know how to do things.
I’m trying to call a function on my spark that has three integer arguments. I’ve written the function and have a Spark.function(); in the void loop() but what I need to do is sent it the arguments somehow and I’m stumped on that.
It’s something to do with curl no doubt but I can’t seem to get the formatting right. I’ve searched the forums but found nothing of use to me.
It there a tu…
Some discussion about why calling a function from the browser doesn't work/isn't supposed to work:
We teach kids how to use the Spark to make Internet controlled robots. It’s a lot of fun, and they make great things!
I have a feature request that would make it a lot easier for kids (and adults) to learn to use the Spark: allow functions to be called with GET as well as POST.
A major principle of our teaching is to “get to the awesome” as soon as possible. Allowing functions to be called with GET would allow us to do this much quicker.
The “Hello World” first example could be triggered with…
A great tutorial on how to call functions from a website:
Let’s say you have a Spark core with both a Spark variable and a Spark function. In my case, I have the world’s simplest servo control sketch, using the nice miniature servo in the Spark Maker Kit. Using these parts, we will build a servo that you can control from a web page anywhere and monitor the position of the servo too!
Here’s a preview of the finished tutorial:
[image]
There is a coarse adjust slider, two fine adjust buttons, and the current position of the servo is displayed. That…
1 Like