I2C 接続の温度センサ ADT7410 用のライブラリの使用例. Demo program of the library for temperature sensor ADT7410 connected using I2C interface.
Dependencies: mbed UIT_ADT7410
Diff: main.cpp
- Revision:
- 2:ed374946c673
- Parent:
- 1:639e2ad4ab5e
- Child:
- 3:176a92f43b5b
diff -r 639e2ad4ab5e -r ed374946c673 main.cpp --- a/main.cpp Mon Jun 15 07:26:32 2015 +0000 +++ b/main.cpp Mon Jun 15 09:18:49 2015 +0000 @@ -27,28 +27,24 @@ lcd_.WriteStringXY("ADT7410", 0, 0); #endif - tempr_.SetConfig(0x80); // 16-bit mode - // Confirmation of setting uint8_t cReg = tempr_.GetConfig(); printf("Mode: 0x%02x\r\n", cReg); while (true) { - // Menber function version + // Member function version // float tempr = tempr_.Read(); // Operator version - float tempr = tempr_; + float value = tempr_; #ifdef USING_AQM1602 char str[8]; - sprintf(str, "%5.1f ", tempr); + sprintf(str, "%5.1f ", value); string s1 = (string)str + (char)0xDF + "C"; lcd_.WriteStringXY(s1, 0, 1); -#else - printf("%5.1f deg. Celsius\r\n", tempr); #endif + printf("%5.1f deg. Celsius\r\n", value); wait(1); } } -