I2C 接続の温度センサ ADT7410 用のライブラリの使用例. Demo program of the library for temperature sensor ADT7410 connected using I2C interface.

Dependencies:   mbed UIT_ADT7410

Revision:
10:dc41d13e64cb
Parent:
9:eabefe7e52be
Child:
11:632e038543e3
diff -r eabefe7e52be -r dc41d13e64cb main.cpp
--- a/main.cpp	Tue Aug 08 11:55:09 2017 +0000
+++ b/main.cpp	Fri Sep 01 11:15:24 2017 +0000
@@ -1,9 +1,10 @@
 //--------------------------------------------------------------
 //  ADT7410 and LCD display using I2C interface
 //      mbed revision: 148
-//  2017/08/08, Copyright (c) 2017 MIKAMI, Naoki
+//  2017/09/01, Copyright (c) 2017 MIKAMI, Naoki
 //--------------------------------------------------------------
 
+#pragma diag_suppress 870   // マルチバイト文字使用の警告を抑制
 #include "ADT7410.hpp"
 using namespace Mikami;
 
@@ -14,7 +15,7 @@
 #ifdef USING_AQM1602
 #include "AQM1602.hpp"
 Aqm1602 lcd_;       // using default I2C port
-#endif
+#endif  // #ifdef USING_AQM1602
 
 ADT7410 tempr_;     // using default I2C port
 
@@ -24,7 +25,7 @@
 #ifdef USING_AQM1602
     bool on = true;
     lcd_.WriteStringXY("ADT7410", 0, 0);
-#endif
+#endif  // #ifdef USING_AQM1602
 
     // Confirmation of setting
     uint8_t cReg = tempr_.GetConfig();
@@ -32,18 +33,16 @@
  
     while (true)
     {
-        // Member function version
-//        float value = tempr_.Read();
-        // Operator version
-        float value = tempr_;
+//        float value = tempr_.Read();    // Member function version
+        float value = tempr_;           // Operator version
 
 #ifdef USING_AQM1602
         lcd_.WriteValueXY("%5.1f \xDF""C", value, 0, 1);
         if (on) lcd_.WriteStringXY(".", 15, 0);
         else    lcd_.WriteStringXY(" ", 15, 0);
         on = !on;
-#endif
-        printf("%5.1f deg. Celsius\r\n", value);
+#endif  // #ifdef USING_AQM1602
+        printf("%5.1f [℃]\r\n", value);
         wait(1);
     }
 }