blinkM i2c LED example code

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
bjo3rn
Date:
Wed Sep 16 18:34:26 2015 +0000
Commit message:
initial commit;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 38e0b84ac173 main.cpp
--- /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);
+    }
+
+}
diff -r 000000000000 -r 38e0b84ac173 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Sep 16 18:34:26 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad
\ No newline at end of file