Asked — Edited

Blink M Question

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?


ARC Pro

Upgrade to ARC Pro

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.

United Kingdom
#1  

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.

PRO
USA
#2  

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

United Kingdom
#3  

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


: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 ARC 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.

#4  

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

PRO
USA
#5  

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.

United Kingdom
#6  

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

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

#7  

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

United Kingdom
#8  

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 ARC 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;


# 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 ARC and use ControlCommand to control the BlinkM control through EZ-Script.

#9  

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.

United Kingdom
#10  

It was the LCD display that's been mentioned on here a few times in the past, DJ has even looked in to it without any real results. A long combination of I2C codes needs to be sent to it in a specific order for it to work and without the datasheet and literally hundreds of thousands of combinations it's not worth the bother. I spent the best part of a day just trying combinations of code that was found in scripts for the Arduino with very little sucess.

I2C is as easy or as hard as the I2C device and documentation allows it to be. Poorly documented I2C devices are a nightmare and near impossible to use but well documented devices like the BlinkM look simple to use.

#11  

I guess you didnt try me on the lcd,i would find the answer on it.

For the right I2C code you need the main chip # a nd then the code for it kinda easy to find it,i done it many times ,not yet on LCD only because i dont use them,i buy a lot of surplus stuff and none can get a data sheet on it,with reverse engineering able to use it,and using good test equipment too

But they are cheap about $10,

United Kingdom
#12  

My topic is here The only information I could find is here

There are a few other forum topics about it that I found when searching but nobody could get close to having it usable in ARC/EZ-Script. Feel free to try though, I'm sure more will attempt it as it's the cheapest LCD out there (and now I know why).

#13  

i wish i saw it i could mostly help,but you trashed it,but if someone gets it i can takea look at it

I HAVE lcd that uses that same chip and with data for it too,with I2C commands

#14  

Here is a idea that works for me everytime,look for lcd with the same chip # and they would have I2C commands,i would buy the lcd and test it to make shore my commands work and then try on one that i have that has no info. and it will work. havent tried it with LCD yet since havent use one ,but other stuff yes it works.

The chip has the commands built-in ,and you cant program it,its same for any lcd,commands are always the same,they dont change from one company to another.

If its using a microprocessor then its different,they change from company to company.

At my company besides electronics designer i am one of the best troubleshooter.

PRO
USA
#15  

Thanks I got them working. I tried a script changing colors after a sleep for 5 sec, but for some reason it will only display one color and not the other ie go from red to blue. But the sliders are great in EZB for setting colors. I'll dive into it a bit more when I have more time. But again thanks for all the help.

PRO
USA
#17  

I2CWrite(0,0x09, c, 0xff) Sleep(5000) I2CWrite(0,0x09, c, 0xc4)

What happens is I have to move the sliders to change the color, then execute script, the first line is ignored then it changes to the second color. Its almost as if the Blink M control panel is over riding with the first color and the script picks up the second color.

United Kingdom
#18  

Have you tried it without the blinkm control panel being loaded in to the project?

PRO
USA
#19  

Just did. No luck. Once killed it stays at the last color I chose and again skips the first color but changes to the second.

PRO
USA
#20  

@DJ how about an Auto Position option for Blink M's so animations are possible? If i can use sliders those sliders should be able to be animated over time?