Kyle Zampaglione
/
I2CTester
big box testing
Diff: I2CTester.cpp
- Revision:
- 0:feff35de571d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/I2CTester.cpp Fri Aug 02 22:32:07 2013 +0000 @@ -0,0 +1,49 @@ +#include "mbed.h" +#include "PCF8575.h" + +Serial pc(USBTX, USBRX); // tx, rx + +//SETUP AND INITIAL DEFINITION +PCF8575 IC(p9, p10, 0x40); // 0x40 means the A0-2 is LOW +PCF8575 IC2(p9, p10, 0x44); // 0x42 means the A0 is HIGH and A1-2 is LOW +DigitalOut myled(LED1); + +char seventeen = 0xFF00; +int sixteen = 0x4000; +int fifteen = 0x2000; +int fourteen = 0x1000; +int thirteen = 0x0800; +int twelve = 0x0400; +int eleven = 0x0200; +int ten = 0x0100; +int seven = 0x0080; +int six = 0x0040; +int five = 0x0020; +int four = 0x0010; +int three = 0x0008; +int two = 0x0004; +int one = 0x0002; +int zero = 0x0001; + + +int main() +{ + pc.printf("Start"); + while (1) { + IC.write(seventeen); + IC.write(zero); + + + //IC2.write(0xFFFF); + myled = 1; + + + wait(1); + + IC.write(0x0000); + //IC2.write(0x0000); + myled=0; + wait(1); + + } +}