![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Demo program of UIT_ACM1602NI for use LCD on NucleoF401.
Dependencies: UIT_ACM1602NI mbed
Diff: main.cpp
- Revision:
- 4:8b1816e38262
- Parent:
- 2:8e082c838a45
- Child:
- 6:8f5c84d52659
diff -r 119586522525 -r 8b1816e38262 main.cpp --- a/main.cpp Thu Dec 04 04:18:10 2014 +0000 +++ b/main.cpp Tue Dec 09 04:27:42 2014 +0000 @@ -1,7 +1,7 @@ //------------------------------------------------------------ // Demo program for LCD ACM1602NI using I2C interface // Pullup resistors for SDA and SCL: 4.7 kΩ -// 2014/12/03, Copyright (c) 2014 MIKAMI, Naoki +// 2014/12/09, Copyright (c) 2014 MIKAMI, Naoki //------------------------------------------------------------ #include "ACM1602NI.hpp" @@ -21,9 +21,15 @@ void TimerIsr() { static int k = 0; + int sec = k % 60; // seconds + int min = k / 60; // minits char str[20]; - sprintf(str, "%d", k++); - lcd_.WriteStringXY(str, 0, 1); + sprintf(str, "%d'", min); + string minSec = str; + sprintf(str, "%2d\"", sec); + minSec = minSec + str; + lcd_.WriteStringXY(minSec, 0, 1); + k++; } int main()