blinkM i2c LED example code
Dependencies: mbed
main.cpp
- Committer:
- bjo3rn
- Date:
- 2015-09-16
- Revision:
- 0:38e0b84ac173
File content as of revision 0:38e0b84ac173:
//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);
}
}