BlinkM + Kinoma Create Code Examples?

I had one of these little BlinkM LEDs lying around so I plugged it into the front pins and powered it up. I see that the Kinoma kernel has a driver for it:

Do you have any code examples showing how you'd access something like this?


  • Yea, i'm pretty much lost. This was a lot easier with Arduino and Raspberry Pi. ;-(

  • Greetings!

    I'm quite familiar with BlinkM, but not with exactly what product you have. Can you send me a link to the model you want to get up and running?

    Basically, you'll want to follow the instructions in the Pins Module tutorial to get your sensor going. If it's just a digital LED, that's very easy. If it has an i2c interface, there's a tiny bit more to.

    — Andy

  • Thanks Andy. It's the standard ThingM BlinkM, spec sheet here:

    It's an I2C device. I figured this would be something simple I could use to learn with, since there are only a couple of pins and you can plug it right into the front of the Kinoma. I can get it to light up and do the default demo sequence, so it's getting power. I used the front pin app to set up ground, power, i2c data and clock.

  • Great, you're off to the right start then. Now to do the more complicated interactions with it, you'll just need to send the appropriate i2c commands.

    As a next step, I might suggest visiting our list of Sample Code and looking at the many i2c samples we have available. If you have questions while looking at them, you'll likely find your answers in the Programming with Hardware Pins documentation or the aforementioned Pins Module tutorial.

    And, of course, keep letting us know how we can help here. I don't have a BlinkM here (that I can find, at least), but I'm sure we could help you work through the details.


    — Andy

  • Thanks, appreciate the help. Maybe I'll buy a temperature sensor to get started with since there's a tutorial for that.

    One last question - is it best to use the standard I2C commands (via Pins module) or would it be better to somehow access this kernel driver? It looks like it has all the standard BlinkM commands built in:

  • Answer ✓

    The kernel driver strikes me as overkill. What you need to do is easy enough to just do in script, and would be good practice at implementing hardware interfaces in JavaScript. Notably, we almost certainly don't build that driver into our kernel, so you'd have to do a custom kernel build to use it.

    — Andy

  • Great, this is helpful. I'll get cracking on the tutorials and post questions when I have them.

  • Ok, I'm taking another stab at this today. I tried to make a BLL, and to write a simple block of bytes to the blinkm. I have two files, blinkm.js and main.js. When I attempt to run it I get an error message.

    Code and error message are here in this gist:

    Can anyone tell me what I'm doing wrong?

  • Here is a second attempt, trying to model my code after the tutorial. With this code it can't seem to find the BLL.

  • I modified the i2c-example code posted here:

    and managed to get a bit further. I am able to provide power and configure the front pins, but as soon as I try to use i2c.writeByte (or any of the other functions I tried) I get "Failed with error kFskErrUnknown"

    I know the BlinkM is working because I just plugged it into an Arduino and tested it. I'm able to change colors and run scripts just fine. Help?

  • Ah, i finally got this working with my Kinoma Element. I think there's something wrong with the way the Create interacts with the I2C bus, because my code worked fine right out of the box with the Element.

    How can I help track down the issue with the Create?

  • Glad to hear you got it working on Kinoma Element!

    Regarding the Kinoma Create issue--if you got it working with the Front Pins app, the interaction with the I2C bus should be fine since that app is written in KinomaJS with the same API calls detailed in the documentation.

    The error you're getting suggests that the sensor isn't responding when being written to. This may be obvious, but double check that your sensor is plugged into the pins that match the numbers in your main.js. You may also want to try plugging it into the back and see if you get the same result. The I2C bus on the front is a soft I2C bus, whereas the one on the back is a real CPU I2C bus so it may behave differently.

    Let us know if using the back pins fixes the problem. We're going to try to order a few of the same sensor to see if we can recreate the issue as well.

  • Thanks, Lizzie. Maybe I'll give the BlinkM another go once you've had a chance to certify it on the Kinoma. I have a feeling something is going wrong with those front side pins because I'm at least able to send one command to the device from my Element.

  • One last post - I did confirm that the back pins on the Create seem to work. Is this expected? Are the front pins appropriate for other kinds of prototyping? Wondering if you've seen similar erratic behavior with digital, serial, PWM, etc.

    If you do end up getting a BlinkM working let me know. The only I2C command I could get it to respond to was "Go to this RGB color now", or 0x6e. Other commands like 0x70 (run script) do not work. I suspect Kinoma's I2C implementation may not be functioning correctly, because I can send I2C commands at the device via an Arduino and it responds as expected.

Sign In or Register to comment.