Chris Styles
/
EA_PCA9532_HelloWorld
Simple Hello World for the PCA9532 on the Embedded Artists Baseboard
main.cpp@0:deb3f7947394, 2010-04-16 (annotated)
- Committer:
- chris
- Date:
- Fri Apr 16 13:28:53 2010 +0000
- Revision:
- 0:deb3f7947394
- Child:
- 1:bd3f6bfeebac
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:deb3f7947394 | 1 | #include "mbed.h" |
chris | 0:deb3f7947394 | 2 | |
chris | 0:deb3f7947394 | 3 | I2C i2c (p28,p27); |
chris | 0:deb3f7947394 | 4 | |
chris | 0:deb3f7947394 | 5 | int main() { |
chris | 0:deb3f7947394 | 6 | |
chris | 0:deb3f7947394 | 7 | char i2c_data[2]; |
chris | 0:deb3f7947394 | 8 | |
chris | 0:deb3f7947394 | 9 | while (1) { |
chris | 0:deb3f7947394 | 10 | i2c_data[0] = 6; // LS0 register |
chris | 0:deb3f7947394 | 11 | i2c_data[1] = 0x0; // all off |
chris | 0:deb3f7947394 | 12 | i2c.write(0xc0,i2c_data,2); |
chris | 0:deb3f7947394 | 13 | wait(0.2); |
chris | 0:deb3f7947394 | 14 | |
chris | 0:deb3f7947394 | 15 | i2c_data[0] = 6; // LS0 register |
chris | 0:deb3f7947394 | 16 | i2c_data[1] = 0x55; // all ON |
chris | 0:deb3f7947394 | 17 | i2c.write(0xc0,i2c_data,2); |
chris | 0:deb3f7947394 | 18 | wait(0.2); |
chris | 0:deb3f7947394 | 19 | } |
chris | 0:deb3f7947394 | 20 | } |