#1

Is there a way to control the color over time or change color of the led due to an event thru some kind of scripting?

#2

Yes. It's an I2C device so you can have your script detecting whatever or waiting for whenever etc. and when the IF statements are satisfied use an I2CWrite command to tell the BlinkM what to do.

#3

ok. How about random changes in color over time? A non programmer here.

#4

If nothing else that could be done using sub code and calling it with goto commands.

For instance, if to turn it red you need to use the code WriteI2C(0x43, 0, 255, 0, 0) use a little piece of code like

Code:


:red
WriteI2C(0x43. 0, 255, 0, 0)
Return()



Do the same for other colours and shades etc. then call them in the script. Picking a random colour would be as easy as using the random number functions and an if elseif to pick the colour based on the random number (I don't have EZ Builder open and don't know the code for random numbers but it's in there somewhere I'm sure).

P.S. Don't use that code, if it's right it is the biggest coincidence ever.

#5

THAT cool,was looking for something for one of my projects ,i heard of the blinky-m ,never got one

NEED to check if it fits in my design,and i just got a order from sparkfun,i guess need to order again

#6

Thanks Richmr2, that will help me with my android eyes. You seem to know a lot about coding. I may have a million questions for you over the coming weeks.

#7

I wouldn't go as far as saying I know a lot, I know enough to make it look like I know a lot Smile

Throw the questions up as and when and I'll help where I can.

#8

FXRST What i found out and i not good at programming thay scripts so far is easy and the examples and code checking makes it easy.

AT least so far it is,even mel (moviemaker) a non programmer is getting the hang of it and me i thought it was hard too,till tried it.

But still go to have other lke RICH to help us out in some codes we are are stuck on .

i wounder if there is a book on doing scripting,lke the book i got for LISPWORKS a very high powerful AI software i am starting to get good at,if stuck my AI group i am in someone always there to help me.

I2C is mostly the hardest so far for me,need to read up on it

RICH on the I2C script you made,dont you need to first set the address of blinkm first ,before a white command, in case there are 2 on the same buss line

#9

As I said, the code I put up for the blinkm was not supposed to be used, it was guesswork and if it does work it is a total coincidence. However I did write the command as if it could be an actual one and the 0x43 part would be the I2C address of the I2C device, the data after that would be the code for the I2C device - this would be in the datasheet for the BlinkM somewhere although with it being supported by EZ-Builder I'm sure DJ could advise on writing the correct data to the device.

I2C is difficult as it varies so much and without the correct details devices can be almost impossible to write to, I had an I2C LCD Display but couldn't get the datasheet for love nor money and therefore couldn't get it to display text at all, playing with some code I found for other microprocessors and controllers helped a little but all it really did was turned on the backlight, flashed the cursor and moved the cursor to the right... Pretty useless really and certainly not what I needed it to do. Needless to say the LCD display is now in a landfill site somewhere.


Having a (very) quick look at the BlinkM Datasheet the commands should look something like;

Code:


# Fade to red
WriteI2C(0x09, c, 0xff)

#Fade to blue
WriteI2C(0x09, c, 0xc4)

#Fade to Green
WriteI2C(0x09, c, 0x30)

# Go to red
WriteI2C(0x09, n, 0xff)

#Go to blue
WriteI2C(0x09, n, 0xc4)

#Go to Green
WriteI2C(0x09, n, 0x30)


The c and n may need to be like 'c' and 'n', I'm unsure. And they are case sensitive as a C command looks like it'll go to a random RGB colour.

Although that may be wrong, like I said it was a very quick look at the datasheet and I don't understand I2C enough to be confident enough in my interpretation.

However, if it does get too complicated you could always add the BlinkM control to EZ-Builder and use ControlCommand to control the BlinkM control through EZ-Script.

#10

thats the same i saw too.when i look at the datasheet on it

I found out is hard to write the code for I2C buss

on that display you couldnt get working it kinda easy to get info on it,if there is a chip #,i forgot the most common chip used for lcd displays using I2C buss ,and then from there can find another display that uses the chip and get the I2C buss info.

Called backwards or reverse engineering,i do it alot at work from other designs others make ,not lcd
but electronic testers,from my head i know most circuit and how they are design along with photographic electronic memory i have.