I2C 接続の LCD AQM1602XA-RN-GBW 用のライブラリの使用例. Demo program of library for LCD 1602XA-RN-GBW connected using I2C interface.
Dependencies: mbed UIT_AQM1602
Diff: main.cpp
- Revision:
- 7:3b3317e5f14e
- Parent:
- 6:3dcecef3aa21
- Child:
- 8:ac09e00d2903
--- a/main.cpp Tue Nov 22 02:05:59 2016 +0000 +++ b/main.cpp Sat Dec 24 02:36:46 2016 +0000 @@ -1,8 +1,10 @@ -//------------------------------------------------------------ -// Test program for LCD AQM1602XA-RN-GBW using I2C interface +//---------------------------------------------------------------- +// Demo program for LCD AQM1602XA-RN-GBW using I2C interface // Pullup resistors for SDA and SCL: 10 kΩ -// 2016/11/22, Copyright (c) 2016 MIKAMI, Naoki -//------------------------------------------------------------ +// Use mbed Rev.129 for Nucleo-F401/446/746 and DISCO-F746 +// +// 2016/12/24, Copyright (c) 2016 MIKAMI, Naoki +//---------------------------------------------------------------- #include "AQM1602.hpp" @@ -26,35 +28,26 @@ // Following: for LPC1768 //Aqm1602 lcd_(p9, p10); // OK -#if defined(STM32F4) || defined(STM32L0) || defined(__STM32F3xx_H) -#define NUCLEO_F4_L0_F3 -#endif - Ticker timer_; -#ifdef NUCLEO_F4_L0_F3 +#ifdef STM_USER_BUTTON DigitalIn uButton_(USER_BUTTON); #endif -// Display 0, 1, 2, ..... -// Each version is available void TimerIsr() { static int k = 0; - - // Using WriteValueXY() and float version lcd_.WriteValueXY("%5.1f", (float)(k++/10.0f), 0, 1); -/* - // Using WriteValue() and int version - lcd_.SetXY(0, 1); - lcd_.WriteValue("%d", k++/10); -*/ } void WaitButton() { -#ifdef NUCLEO_F4_L0_F3 +#ifdef STM_USER_BUTTON lcd_.WriteStringXY("Push blue button", 0, 1); + #ifdef STM32F7 + while (uButton_ == 0) {} + #else while (uButton_ == 1) {} + #endif #else wait(1); #endif @@ -81,4 +74,3 @@ while (true) {} } -