blinkM i2c LED example code

Dependencies:   mbed

Revision:
0:38e0b84ac173
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 16 18:34:26 2015 +0000
@@ -0,0 +1,19 @@
+//blinkM example
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+//I2C(PinName sda, PinName scl):
+I2C i2c(D7,D6);
+int address = 0x09 << 1; //(7bit address left shifted by one)
+//http://thingm.com/fileadmin/thingm/downloads/BlinkM_datasheet.pdf
+char color[4] = {'n',0xff,0x00,0x00};
+char color2[4] = {'n',0x00,0x00,0xff};
+int main() {
+    while(1) {
+        i2c.write(address, color, 4);
+        wait(0.2);
+        i2c.write(address, color2, 4);
+        wait(0.2);
+    }
+
+}