Hello code for "Switch Science mbed LPC824"
Fork of SwitchSciencembedLPC824_test by
Diff: main.cpp
- Revision:
- 9:e2333773718f
- Parent:
- 7:553960b756ed
- Child:
- 10:e508d79a907f
--- a/main.cpp Mon Nov 03 00:48:14 2014 +0000 +++ b/main.cpp Thu Dec 18 03:20:52 2014 +0000 @@ -1,25 +1,37 @@ /** Hello code for "test_LM75B" */ #include "mbed.h" -#include "test_LM75B.h" +#include "TempSensor_LM75B.h" +#include "TextLCD_SB1602E.h" + +#define TEST_LOOP 1 +#define DEFAULT_TIME_INTERVAL 1.0 +#define DEFAULT_TIME_INTERVAL_PUTx 0.2 -test_LM75B temp0( p28, p27 ); +#define CONTRAST_ADJUST_TEST +#define PRINTF_TEST +#define CGRAM_FUNCTION_TEST +#define PUTS_TEST_WITH_ESCAPE +#define PUTS_TEST_WITHOUT_ESCAPE +#define PUTC_TEST -I2C i2c( p28, p27 ); -test_LM75B temp1( i2c ); + +I2C i2c( dp4, dp5 ); // sda, scl +TempSensor_LM75B thermo_sensor_0( &i2c ); +TextLCD_SB1602E lcd( &i2c ); //sda,,scl 液晶 + +/*デバッグ用*/ +//Serial pc( USBTX, USBRX ); // tx, rx int main() { - float t0; - float t1; - - i2c.frequency( 400 * 1000 ); - - while(1) { - t0 = temp0; - t1 = temp1; - printf( "temp = %7.3f, %7.3f\r\n", t0, t1 ); + int i = 0; + /*デバッグ用*/ +// pc.printf("test\r\n"); + while (1) { + pc.printf( " (%d) sensor_0= %4.1f\r\n", i++, (float)thermo_sensor_0 ); + lcd.printf(0,"temp=\n"); + lcd.printf(1,"%4.1f\n",(float)thermo_sensor_0); wait( 1 ); } -}