Creating a "blink(1)"-like Spark Core firmware

For those that don’t know blink(1) (also kickstarter projects - original and mk2), it’s a small USB dongle with just one (or 2 for mk2) RGB LED(s), that is programmable/accessible via an API and such (ifttt for example), so you can make it blink in specific colors, patterns and timing for different occasions, such as a mention on twitter, package arrival, etc…

Since it’s “just” an RGB LED, I thought about creating one myself, using the Spark Core and its colorful LED (or just an RGB LED).
Anybody has an idea on how should the firmware work ? Exposing a method for each characteristic (color, delay, smell :smile:) ?
I’m pretty low on ideas about how to do it, so any advice or idea would be awesome!

Thanks!

What I would do is expose a Spark function that’s looking for a hex code. Some pseudo code:

setup() {
  Spark.function("color", changeColor);
  RGB.control(true);
}

loop() {}

int changeColor (String args) {
  int red = // pull the red value from args
  int green = //pull the green value from args
  int blue = // pull the blue value from args

  RGB.color(red, green, blue);
}

And now you’ve got an API call for the LED!

POST https://api.spark.io/v1/devices/your_device/color

2 Likes

I have a pair of blink(1)'s from the Kickstarter and while the idea is sound and the hardware is great, the desktop software left a lot to be desired.

I would bypass the whole desktop/USB intermediary. For instance, I used one of my blink(1)'s to show the weather for the next twelve hours: white for snow, red for rain, blue for clear, etc. Why not just have the Spark core fetch the weather forecast scraping it from a web page and light the LED appropriately?

2 Likes