Asked — Edited

Blinkm

This is how you use the blinkmk in ARC .

The address of the blinkm is default 0x09 (that's 7 bit). you need to turn that number into an 8 bit number to write, that's 0x12. The LSB of the i2c address is reserved for the direction of data. A 1 in the LSB means READ, and a 0 in LSB means WRITE.

If you look at the datasheet (google search blinkm datasheet), you'll see commands.

This will turn a blinkm to the color red:


I2CStart()
I2CWrite(0x12, 0x6e, 0xff, 0x00, 0x00)
I2CStop()

This is how you turn a blinkm to the color green


I2CStart()
I2CWrite(0x12, 0x6e, 0x00, 0xff, 0x00)
I2CStop()

This is how you turn a blinkm to the color blue


I2CStart()
I2CWrite(0x12, 0x6e, 0x00, 0x00, 0xff)
I2CStop()

note: hex is NOT case sensitive. you can use upper or lower case, it doesn't matter. 0xFF also equals 0xff. However, 0XFF is not hex. The X is always lower case in HEX. Google will help you understand why.

You may also not use hex and use characters instead. Like most programming languages, characters are defined with single quotes ' and strings are defined with double quotes ". You can use the letter 'n' instead of 0x6e in this peice of code...


I2CStart()
I2CWrite(0x12, 'n', 0x00, 0x00, 0xff)
I2CStop()


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

PRO
Synthiam
#2  

Hello Nial, you can either use the BlinkM control under the i2c menu option (Add Control -> i2c -> BlinkM) and manually contorl the blinkm

For real-time control, you the above demonstrates how to write a script to do that.

  1. Add a SCRIPT control (Add Control -> Scripting -> Script)

  2. Press Configure

  3. Copy in my example code

  4. Press Save

  5. Press START on the script control (assuming you are already connected to the ez-b)

#3  

Ok thanks dj I'll try it out tonight much appreciation.

#4  

how do i erase the original program from the blink m i have the original running and then the scrpit play and it goes bact to the original demo program on the blink m

PRO
Synthiam
#5  

Check the blinkM datasheet. Somewhere in there it says a command to "Stop" the script.