![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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:
- 2015-11-15
- Revision:
- 3:fe2f8abf2120
- Parent:
- 2:6e609a28fa80
- Child:
- 4:291e82d910d0
File content as of revision 3:fe2f8abf2120:
//------------------------------------------------------------ // Test program for LCD AQM1602XA-RN-GBW using I2C interface // Pullup resistors for SDA and SCL: 10 kΩ // 2015/11/15, 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 Ticker timer_; DigitalIn uButton_(USER_BUTTON); // 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); while (uButton_ == 1) {} 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) {} }