Nucleo F401RE で使える I2C 接続の LCD ACM1602Ni 用のライブラリの使用例. Demo program of library for LCD ACM1602Ni connected using I2C interface on Nucleo F401.

Dependencies:   UIT_ACM1602NI mbed

Revision:
1:d5e9bd9b38ad
Parent:
0:132eb47d57fb
--- a/main.cpp	Mon Jul 06 09:46:13 2015 +0000
+++ b/main.cpp	Fri Apr 01 04:29:04 2016 +0000
@@ -1,7 +1,7 @@
 //------------------------------------------------------------
 // Demo program for LCD ACM1602NI using I2C interface
 //      Pullup resistors for SDA and SCL: 4.7 kΩ
-// 2015/04/16, Copyright (c) 2015 MIKAMI, Naoki
+// 2016/04/01, Copyright (c) 2016 MIKAMI, Naoki
 //------------------------------------------------------------
 
 #include "ACM1602NI.hpp"
@@ -21,11 +21,15 @@
 void TimerIsr()
 {
     static int k = 0;
-    int sec = k % 60;   // seconds
-    int min = k / 60;   // minits
+
+    div_t ms = div(k, 60);
+/*
     char str[20];
-    sprintf(str, "%d'%2d\"", min, sec);
+    sprintf(str, "%d'%2d\"", ms.quot, ms.rem);
     lcd_.WriteStringXY(str, 0, 1);
+*/
+    lcd_.WriteValueXY("%d'", ms.quot, 0, 1);
+    lcd_.WriteValue("%2d\"", ms.rem);
     k++;
 }