Exemple 1 CRTI
Dependencies: C12832 LM75B mbed
Fork of app-board-LM75B by
Diff: main.cpp
- Revision:
- 1:6484448034e3
- Parent:
- 0:ce7a8546502b
- Child:
- 2:9e757151de9b
diff -r ce7a8546502b -r 6484448034e3 main.cpp --- a/main.cpp Sat Jan 16 02:41:51 2010 +0000 +++ b/main.cpp Thu Oct 18 13:09:21 2012 +0000 @@ -22,7 +22,6 @@ */ #include "mbed.h" -//#include "SDFileSystem.h" // LM75B IIC address #define LM75B_ADDR 0x90 @@ -37,7 +36,7 @@ DigitalOut led[] = { LED4, LED3, LED2, LED1 }; Serial pc(USBTX, USBRX); // tx, rx -I2C i2c( p9, p10 ); // sda, scl +I2C i2c( p28, p27 ); // sda, scl void iic_write( char addr, char reg, char data ); @@ -52,18 +51,16 @@ int i; init_temp_sensor( 0 ); - init_temp_sensor( 1 ); while(1) { - pc.printf( " (%d) temp[0]=%6.3f, temp[1]=%6.3f(degree-C)\n", i++, get_temp( 0 ), get_temp( 1 ) ); + pc.printf( " (%d) temp[0]=%6.3f, \n", i++, get_temp( 0 ) ); wait( 1 ); } } void init_temp_sensor( char dev_num ) { - dev_num <<= 1; - + dev_num <<= 1; iic_write( LM75B_ADDR | dev_num, Conf, 0x00 ); // configuration pc.printf( "sensor[%d] : Conf register read out = 0x%02X\n", dev_num, iic_read( LM75B_ADDR | dev_num, Conf ) ); pc.printf( "sensor[%d] : Tos register read out = 0x%04X\n", dev_num, iic_read_short( LM75B_ADDR | dev_num, Tos ) );