I2C 接続の温度センサ ADT7410 用のライブラリの使用例. Demo program of the library for temperature sensor ADT7410 connected using I2C interface.
Dependencies: mbed UIT_ADT7410
Diff: main.cpp
- Revision:
- 3:176a92f43b5b
- Parent:
- 2:ed374946c673
- Child:
- 4:6e320628cbc9
--- a/main.cpp Mon Jun 15 09:18:49 2015 +0000 +++ b/main.cpp Sun Jun 28 09:29:40 2015 +0000 @@ -1,13 +1,13 @@ //-------------------------------------------------------------- // ADT7410 and LCD display using I2C interface -// 2015/06/15, Copyright (c) 2015 MIKAMI, Naoki +// 2015/06/28, Copyright (c) 2015 MIKAMI, Naoki //-------------------------------------------------------------- #include "ADT7410.hpp" // If you want to display the temperature on AQM1602, // enable following #define statement -//#define USING_AQM1602 +#define USING_AQM1602 #ifdef USING_AQM1602 #include "AQM1602.hpp" @@ -24,6 +24,7 @@ { printf("\r\nStart ADT7410\r\n"); #ifdef USING_AQM1602 + bool on = true; lcd_.WriteStringXY("ADT7410", 0, 0); #endif @@ -43,6 +44,9 @@ sprintf(str, "%5.1f ", value); string s1 = (string)str + (char)0xDF + "C"; lcd_.WriteStringXY(s1, 0, 1); + if (on) lcd_.WriteStringXY(".", 15, 0); + else lcd_.WriteStringXY(" ", 15, 0); + on = !on; #endif printf("%5.1f deg. Celsius\r\n", value); wait(1);