I2C 接続の LCD AQM1602XA-RN-GBW 用のライブラリの使用例. Demo program of library for LCD 1602XA-RN-GBW connected using I2C interface.
Dependencies: mbed UIT_AQM1602
main.cpp
- Committer:
- MikamiUitOpen
- Date:
- 2016-01-14
- Revision:
- 4:291e82d910d0
- Parent:
- 3:fe2f8abf2120
- Child:
- 5:d63f1c2d8027
File content as of revision 4:291e82d910d0:
//------------------------------------------------------------ // Test program for LCD AQM1602XA-RN-GBW using I2C interface // Pullup resistors for SDA and SCL: 10 kΩ // 2016/01/14, Copyright (c) 2015 MIKAMI, Naoki //------------------------------------------------------------ #include "AQM1602.hpp" using namespace Mikami; Aqm1602 lcd_; // Default, OK //Aqm1602 lcd_(D14, D15); // OK //Aqm1602 lcd_(D14, D15, 200000); // OK //Aqm1602 lcd_(D14, D15, 200000, true, true); // OK //Aqm1602 lcd_(PB_3, PB_10); // OK //Aqm1602 lcd_(PC_9, PA_8); // OK //Aqm1602 lcd_(PB_4, PA_8); // OK //I2C i2cObj_(D14, D15); //Aqm1602 lcd_(i2cObj_); // OK // Following: for LPC1114 //Aqm1602 lcd_(dp5, dp27); // OK //I2C i2cObj_(dp5, dp27); //Aqm1602 lcd_(i2cObj_); // OK // Following: for LPC1768 //Aqm1602 lcd_(p9, p10); // OK Ticker timer_; #if defined(STM32F4) || defined(STM32L0) || defined(__STM32F3xx_H) DigitalIn uButton_(USER_BUTTON); #endif // Display 0, 1, 2, ..... void TimerIsr() { static int k = 0; char str[10]; sprintf(str, "%d", k++); lcd_.WriteStringXY(str, 0, 1); } void WaitButton() { lcd_.WriteStringXY("Push blue button", 0, 1); #if defined(STM32F4) || defined(STM32L0) || defined(__STM32F3xx_H) while (uButton_ == 1) {} #else wait(2); #endif lcd_.ClearLine(1); wait(0.5); } int main() { if (lcd_.IsConnected()) printf("\r\nConnected"); else printf("\r\nDisconnected"); lcd_.Clear(); lcd_.WriteString("Hello!"); WaitButton(); // Waiting, push blue user button lcd_.WriteStringXY("0123456789ABCDEF", 0, 0); WaitButton(); // Waiting, push blue user button lcd_.ClearLine(0); WaitButton(); // Waiting, push blue user button string str = "AQM1602"; lcd_.WriteStringXY(str+"XA-RN-GBW", 0, 0); TimerIsr(); timer_.attach(&TimerIsr, 1); while (true) {} }