Get your own customer support community
 

Limiting Random Colors on a Standalone BlinkM

I'm trying to get a standalone BlinkM to run through a limited set of random colors. For example, I want only random colors from red to yellow. In some of the built-in scripts, I see that "random" colors (e.g. "old neon") aren't random, but a hard-coded list of specific colors.

I wrote a sketch that first sets the color to red and then writes a script with the following call: { script_speed, {'H', 60 ,0x00,0x00}}. It seems that setting the first param to a low value limits the amount of change related to the last color, rather than the baseline (in this case red).

I abandoned scripts in favor of the making calls to BlinkM_fadeToRGB() in the loop() function. This way I can generate a random number in each loop. The only problem is that this doesn't work for standalone applications. Adding calls to BlinkM_setStartupParams and BlinkM_playScript doesn't make sense, since there is no script being written (although I tried adding them in a desperate attempt to make it work).

So, how would one go about writing a script for standalone applications where, for example, the red value would always be 255 and the green value would be a random number between 0 and 255 each time the script was repeated?

Thanks,
jeff
 
indifferent I’m Puzzled but hopeful
Inappropriate?
1 person has this question

User_default_medium