Library - BlinkM command wrapper

[title]BlinkM command wrapper[/title]
A great starting point for controlling I2C ThingM devices like the BlinkM, MinM,and MaxM from your FEZ.

Fixed your issue.

blinkm question:

The good news:
I use this lib successfully, and can generally control the blinkm OK.

However there are a couple of behaviors I do not understand:

#1: Does the blinkm have some kind of default pattern saved, that it plays on power up? At times, my blinkm seems to be “doing its own thing” not related to commands I have used.

#2: Getting full control: I seem to lack %100 control.
When I do this:


It works fine.

When I do this:

                blink.GoToRGB(255, 0, 0);
                blink.GoToRGB(0, 255, 0);

It works fine.

But if I do this:

blink.GoToRGB(0, 0, 255);  // solid blue
// now go execute some unrelated code, sleep elsewhere in app

it goes to blue briefly, and then “does its own thing”

[italic]Why is my command only “sticking” briefly?[/italic]


Thank you!

It is possible that it is something else in your code. Can you show the rest of your code?

Yes, it does, and it will revert to it if power is reset. I suggest you read the BlinkM documentation available on their website.


Add this to the blinkm library:

        // Following lets us set the startup params in the blinkm
        // We make the params optional, by default this will set the blinkm to do nothing on startup.
        // Note that this is saved to blinkm eeprom, so it only needs to be called once in awhile, or once ever 
        // for a given blinkm. E.g. should not be called repeatedly in a loop.
        public void SetStartup(int Param1 = 0, int Param2 = 0, int Param3 = 0, int Param4 = 0, int Param5 = 0)
            // set up the command
            var cmd = new byte[6] { (byte)CmdChar.B, IntToByte(Param1), IntToByte(Param2), IntToByte(Param3), IntToByte(Param4), IntToByte(Param5) };

@ samjones3 - this class is certainly not a comprehensive implementation of all BlinkM commands, as noted in the comments. Are you up for adding the remaining stuff? If so, you can email the results to my user name at gmail and I will update the shared code.

@ ransomhall: I would love to, but it is probably out of my range. I am not experienced enough to contribute code for others. This was just something I stumbled on while working with your lib.

Thanks for the lib! I couldn’t use blinkm without it!