Control LEDs over the ‘net for beginners

Sorry but your documentation for someone who knows nothing about spark (but some about arduino) is clear as mud.

I dont have a clue what to do with this stuff below.
It doesnt work in command prompt (Node.js)

> POST /v1/devices/{DEVICE_ID}/led

> # Core ID is 0123456789abcdef01234567
> # Your access token is 1234123412341234123412341234123412341234
> curl \
>   -d access_token=1234123412341234123412341234123412341234 \
>   -d params=l1,HIGH

there should be a link to load the entire code. ie github. I dont know whats supposed to be in spark, and whats at command prompt

curl ( is a command line tool for sending HTTP requests. It comes with Linux and can be downloaded for both Windows and Mac. In the example above it breaks out what you should be sending. If you look at your cores in spark build you can find your Device ID and in settings you can find your access token. Replace the values so it’s looks like this:

curl[DEVICE ID]/led \
  -d access_token=[ACCESS TOKEN] \
  -d params=l1,HIGH

For the params l1 stands for LED1, l2 would be LED2, the second part HIGH would turn it on and switching it to LOW would turn it off.

The POST comment is the general structure (say if you were doing it from an APP) and you stop right before there with the code in the build environment.

1 Like

The entire code for the Spark can be found inside the web IDE, once you click on your apps, it says “blink a LED”, if you click that, it should load the code from github. You then only have to worry about a method for sending the requests. Curl would be good for that. But you can do it using some browser extensions (postman for chrome I believe). Using java and Ajax is also possible. You just need a post request in your favorite language :slight_smile: