Spark Core Web App

Ok it’s finally time to release this baby! This is my first web app, and it couldn’t have been for a better product.

Spark Core Web App (Live Demo)
http://sparkcore.herokuapp.com/

Right now it just allows you to toggle all of the digital I/O and for visual symmetry and to show the error messages, I have digital togglers for the analog inputs as well. Obviously these are not digital outputs. It’s going to be further refined as the Spark API is developed, so please give me your feedback and suggestions. One idea I have for generic “remote control” type web apps like this one, is to request the pin configuration from the Spark Core, and set up all of the controls on the web app properly.

Even though this is styled pretty heavily, it’s meant to be a “seed” type of web app which allows you to take it, see how it works and hack it up just how you like it.

You can of course watch/fork the github repo here: released under the MIT License: https://github.com/technobly/SparkCore-WebApp

And don’t forget about the Node.js wrapper for the Spark API that is currently in progress as well here: https://github.com/technobly/SparkAPI-NodeJS
I will be modularizing this to make it much easier to install and use.

8 Likes

Um, amazing! @BDub, do you mind if we share this around? Would love to blast it on all those social networks and things

@zach of course! Thanks :smile:

I was expecting something “engineer” looking, but that is absolutely pro app. Simple and nice looking, but also the code is clean and effective.

Thanks @weakset that means a lot. I started by making it look good, then hooked up the business end. Functionally it has a long way to go before it meets the vision I have for it in my head. If you’ve looked at the code thus far you might have seen it was application/x-www-form-urlencoded but since I worked out the CORS issues with @zachary I really wanted to have this be application/json encoded, so I just made that change to the controllers.js

So awesome. I don’t have my Spark Core yet, but when I do, I’m going to fire it up with this thing.

(btw, small thing, but currently the text box for RAW is listening for clicks and sending to pin A7)

@kudos kudos on the catch, I was wondering if anyone would see that. I was testing out a method for changing the pin type by seeing if I could make the text have a click function with AngularJS. The idea would be you click the pin and it presents you with a small modal [ Digital Input / Digital Output / Analog Input / PWM (if available) ], and then you select what you want and the controls for that pin change accordingly.

I don’t have mine yet, so how does this work exactly?

I’m getting “success” even if I change the name to “okokookko” and toggle a pin high/low.

@funkytaco it’s basically sending an HTTP POST request in JSON format to the Spark API for the pins you are trying to toggle, and getting back an “ok”:true response if successful, like this: http://i.imgur.com/UahF2Ut.png

It’s actually more involved than that, but that’s the basics.

Apparently right now you can change your device name to anything and they all seem to work. That won’t be the case forever though.

It would be awexome if the Spark Team could put a real Spark Core up there for us to flog with API requests, with a way to test out most of the various API calls. Like right now my web app should toggle any of the Digital Outputs… but doing a read won’t give you any data (since there is no device on the other end), and the Digital Input right now is streaming… it would be nice to also have a simple GET request that just took a reading on any digital input. That would make it easier to handle in the web app. There is obviously a place and need for streaming data as well… just not when you need to check if something is on or not.

1 Like

Oh yeah, @BDub, we had this conversation before. The OK just means the API received the call, but not the “Thing”. I should probably wait until mine arrives before I chime in too much.

Cool project. I might use this for a wedding project if I get mine in time, so thanks.

Haha, so we did… I was going to mention that but I was going to wait and see if you wanted more info :wink:

I’m interested to see what ideas you have and what you come up with… This web app is fairly re-configurable for a dedicated purpose such as a garage door opener/monitor, and cheap as free for anyone that doesn’t have a web host (if you need to access it from your phone on the road).