Get your own customer support community
 

Scripting the BlinkM

I just started working with the BlinkM and Arduino Diecimila. I'm trying to program up the BlinkM to fade randomly from one color to another, looping until I cut the power to the BlinkM.

I started off with the example "Programming Light Scripts" from the BlinkM datasheet. This apparently is full of mistakes. I fixed it, I think, see bellow:

#include "Wire.h"
#include "BlinkM_funcs.h"
void setup(){
blinkm_script_line script_lines[] = {
{ 1, {'f', 20,0x00,0x00}}, // set fade speed to 1
{ 1, {'C', 0xff,0xff,0xff}}, // randomly alter
};
byte addr = 0x09;
byte script_id = 0; // can only write to script 0
byte script_len = 2; // number of lines in script
byte script_rep = 20;
BlinkM_beginWithPower();
BlinkM_writeScript(addr, script_id, script_len, script_rep, script_lines);
}
void loop(){}

Now, I think, this is supposed to get the BlinkM to set the scrip to randomly fade colors but I'm just getting the default blink pattern.

Any ideas?

Thanks - AYAL
 
sad I’m frustrated
Inappropriate?
1 person has this question

User_default_medium