Test
Dependencies: mbed AccelSensor
Diff: main.cpp
- Revision:
- 3:4e4e4d7f6ee1
- Parent:
- 2:3e6b509d7eca
- Child:
- 4:3397631c2f65
--- a/main.cpp Tue Jan 15 04:19:52 2013 +0000 +++ b/main.cpp Tue Jan 15 05:25:08 2013 +0000 @@ -2,8 +2,11 @@ I2C i2c(p9, p10); // sda, scl Serial pc(USBTX, USBRX); // tx, rx +Serial Damn(p28,p27); + const int addr = 0x9A; // define the I2C Address for TC74-A0 +const int Afficheur_addr = 0xE2; // define the I2C Address for 4*7seg display int main() { @@ -13,7 +16,9 @@ wait(1); //Make sure system is fully initialized - + cmd[0] = 0x76; + i2c.write(Afficheur_addr,cmd,1); + while(1) { pc.printf("\r\n\nStart reading the temperature of TC74 on I2C\r\n"); @@ -41,6 +46,7 @@ //-----------------Print out section ---------------------- //Display device Address and informations + pc.printf("Device with address 0x%x with\r\n", addr); //Prints out the result of Method 1 @@ -50,8 +56,31 @@ //Prints out the Data from Method 2 pc.printf("Method 2 :: %d\r\n\n", cmd[0]); + cmd[0] = 0x7b; + cmd[1] = 0x3E; + + i2c.write(Afficheur_addr,cmd,2); + wait(0.07); + cmd[0] = 0x7c; + cmd[1] = 0x79; + + i2c.write(Afficheur_addr,cmd,2); + + wait(0.07); + + cmd[0] = 0x7d; + cmd[1] = 0x77; + + i2c.write(Afficheur_addr,cmd,2); + + wait(0.07); + + cmd[0] = 0x7e; + cmd[1] = 0x3F; + + i2c.write(Afficheur_addr,cmd,2); wait(1); } } \ No newline at end of file