This is how you use the blinkmk in ez-builder.
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:Code:
I2CStart()
I2CWrite(0x12, 0x6e, 0xff, 0x00, 0x00)
I2CStop()
This is how you turn a blinkm to the color green Code:
I2CStart()
I2CWrite(0x12, 0x6e, 0x00, 0xff, 0x00)
I2CStop()
This is how you turn a blinkm to the color blueCode:
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...Code:
I2CStart()
I2CWrite(0x12, 'n', 0x00, 0x00, 0xff)
I2CStop()
Asked
— Edited
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)