I had posted about a year ago, about trying to script the blinkM to bend to my will. I have need to get ahold of this little guy but running into the exact same trouble as before. The BlinkM come preloaded with about 18 scripts. The default script plays as soon as it receives power. Now if I start the blinkm controller located in the i2c folder the interface comes up. The only way to control the blinkM is to hit the stop script., which it does and glows whatever color it was on at the time of hitting that button. With the sliders i can control the color of the LED. Now I open up a script and use the i2cwrite, to tell it to goto a color, i.e I2CWrite(0, 0x09, 178,102,255). I can see the script being sent on the blue led on the ezb3, so I know its sending, but the blink, just remains the same color as when I pressed the stop script button on the blinkm control board. Now why not just use the control panel? Because I want to be able to changes the colors over time by calling scripts etc.
Any help to sort this out would be appreciated. If need be I can upload a video of the set up and my issue.
BTW the manual still has the Sendi2c as the command, instead of "write" and needs to be updated.
I haven't tried these in any recent update but this is the code I have been using which worked...
# BlinkM Examples
# Use I2CWrite
# Default address 0x09
# Change the address to 0x0a
# Address now 0x0a
# Change the address back to 0x09
# Address now 0x09
# White light
# Red light
# Green light
# Blue light
# Fade to yellow light
# Fade to black (off)
Pushed for time right now but hope that's of some use to you. I'll revisit this when I get chance if you need more help.
Note: The above is old syntax, put the A, n, c etc. in quotes to meet new syntax. i.e. I2CWrite(0,0x09,"n",0x00,0x00,0xff) or I2CWrite(0,0x09,"c",0x00,0x00,0xff)
Looking a bit closer, it is likely to be your I2CWrite commands which are the issue. If you want me to check it out feel free to post it (or email it if you want to keep it private)
Thanks Rich. I will give it a spin tonight and see what i can get to work.
Rich, your awesome. Because I want to learn, not just copy and paste, I'd like to ask you a few questions on your code. What did changing the address do? What do "A,c,n" do in the code? Everything else I got. Also do you have a good source for RGB to hex conversion? I'd like to find the perfect color and then use the blinkm console to derive the color RGB , ie 255,0,121 as an example, then convert that in the code to hex.
Changing the address is so you can use more than one BlinkM and control each individually. If you used two without changing the address then all commands would control both BlinkMs (which may be ideal for some applications but some may require different patterns or colours for each).
The BlinkM Datasheet is really well laid out and should explain everything a bit better than I can (see page 17) but the basics are;
n = Go to RGB colour now
c = fade to RGB colour
h = fade to HSB colour
C = fade to random RGB colour
H = fade to random HSB colour
p = play light script
o = stop script
f = set fade speed
t = set time adjust
g = get RGB current colour
W = write script line
R = read script line
L = set script length and repeats
A = set address
a = get address
Z = get firmware version
B = set startup parameters
Note: These are Case Sensitive
So, for instance, to fade to red, to green then to blue the code would be something like this,
# fade to red
# fade to green
# fade to blue
Or to flash red/blue like police lights the code would be something like;
# change to red now
# change to blue now
The main commands are c (fade to) and n (go to now) followed by the hex for the shade of red, hex for the shade of green then hex for the shade of blue.
Since scripting in EZ-Builder is pretty simple I've not needed to use the built in script functions of the BlinkM, I just have a bunch of scripts which run the I2CWrite commands for the patterns.
As for dec to hex conversion, windows calculator can do that. I do it mentally (I have been using hex for nearly 20 years now) but set Windows calculator to programmer mode (Alt & 2 or view programmer), make sure it's on dec, type in the number i.e. 138, hit the hex radio button and it will give you the hex code (8A in this case).
Or google dec to hex and I expect millions of online calculators will pop up.
Brilliant and thanks so much for pointing me in the right direction!