Node.js SparkCore Library

I created a micro-library for controlling your SparkCore from Node.js:

It’s basically just syntactic sugar at this point, but I hope to keep hacking on it and building it out further. Let me know if you have any suggestions/needs. I will likely need to make a lot of updates as I play with and integrate sensors.

Also if there are any existing node.js libraries, please link them - I was having a hard time finding existing stuff. Thanks!


That’s pretty slick, thanks! Just got my Raspberry Pi interacting with the Core over WiFi via Sparky; I can picture a lot of uses for this!

1 Like

I am definitely interested!!! I will follow your work. Thank you

This is great, thanks! Is there a way to read spark variables?

I just added support for this. Right now you can use the following code to get a response for a variable. It looks like the SparkCore team is still building out the variable return data structure, so in the meantime the callback just receives the entire server response. It would be nice if we could give the function the variable as you intended from the spark core firmware though (directly in number or string format for example).

var Sparky = require('sparky')

var core1 = new Sparky({
    deviceId: 'your device id',
    token: 'your access token',

core1.get('MyCustomVariable', function(response) {
    // Full response of the SparkCore API resides in the first argument
1 Like

This is awesome man! Great job!

Great Job!!

only one little thing … You’re using curl to create the request … I modified your version a bit. And i’m using restler to create the requests to the api.

I did this because i don’t have any curl running on my windows machine … And by using the restler node_module you’re able to do the same thing … only without using this curl library …

If you’re interested … just let me know something and I’ll send you the link …

1 Like

That’s a good idea, and I didn’t think of that. If you want to send me a pull request, I’d love to have your patch, and I’m sure others would as well :smile:

1 Like

sorry for the late reaction, but i’m gonna do that later on … first have to figure out the github … i’m more a tfs guy :wink: