![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Demo program of UIT_ACM1602NI for use LCD on NucleoF401.
Dependencies: UIT_ACM1602NI mbed
main.cpp@1:3563f4c06d9e, 2014-11-13 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Thu Nov 13 04:51:11 2014 +0000
- Revision:
- 1:3563f4c06d9e
- Parent:
- 0:d42990d2724c
- Child:
- 2:8e082c838a45
2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:d42990d2724c | 1 | //------------------------------------------------------------ |
MikamiUitOpen | 1:3563f4c06d9e | 2 | // Demo program for LCD ACM1602NI using I2C interface |
MikamiUitOpen | 0:d42990d2724c | 3 | // Pullup resistors for SDA and SCL: 4.7 kΩ |
MikamiUitOpen | 1:3563f4c06d9e | 4 | // 2014/11/13, Copyright (c) 2014 MIKAMI, Naoki |
MikamiUitOpen | 0:d42990d2724c | 5 | //------------------------------------------------------------ |
MikamiUitOpen | 0:d42990d2724c | 6 | |
MikamiUitOpen | 0:d42990d2724c | 7 | #include "ACM1602NI.hpp" |
MikamiUitOpen | 0:d42990d2724c | 8 | using namespace Mikami; |
MikamiUitOpen | 0:d42990d2724c | 9 | |
MikamiUitOpen | 0:d42990d2724c | 10 | Acm1602Ni lcd_; // Default, OK |
MikamiUitOpen | 0:d42990d2724c | 11 | //Acm1602Ni lcd_(D14, D15); // OK |
MikamiUitOpen | 0:d42990d2724c | 12 | //Acm1602Ni lcd_(D14, D15, 200000); // OK |
MikamiUitOpen | 0:d42990d2724c | 13 | //Acm1602Ni lcd_(D14, D15, 200000, true, true); // OK |
MikamiUitOpen | 0:d42990d2724c | 14 | //Acm1602Ni lcd_(PB_3, PB_10); // OK |
MikamiUitOpen | 0:d42990d2724c | 15 | //Acm1602Ni lcd_(PC_9, PA_8); // OK |
MikamiUitOpen | 0:d42990d2724c | 16 | //Acm1602Ni lcd_(PB_4, PA_8); // OK |
MikamiUitOpen | 0:d42990d2724c | 17 | |
MikamiUitOpen | 0:d42990d2724c | 18 | Ticker timer_; |
MikamiUitOpen | 0:d42990d2724c | 19 | |
MikamiUitOpen | 0:d42990d2724c | 20 | // Display 0, 1, 2, ..... |
MikamiUitOpen | 0:d42990d2724c | 21 | void TimerIsr() |
MikamiUitOpen | 0:d42990d2724c | 22 | { |
MikamiUitOpen | 0:d42990d2724c | 23 | static int k = 0; |
MikamiUitOpen | 0:d42990d2724c | 24 | char str[20]; |
MikamiUitOpen | 0:d42990d2724c | 25 | sprintf(str, "%d", k++); |
MikamiUitOpen | 0:d42990d2724c | 26 | lcd_.WriteStringXY(str, 0, 1); |
MikamiUitOpen | 0:d42990d2724c | 27 | } |
MikamiUitOpen | 0:d42990d2724c | 28 | |
MikamiUitOpen | 0:d42990d2724c | 29 | int main() |
MikamiUitOpen | 0:d42990d2724c | 30 | { |
MikamiUitOpen | 0:d42990d2724c | 31 | lcd_.Clear(); |
MikamiUitOpen | 0:d42990d2724c | 32 | lcd_.WriteString("Hello World!"); |
MikamiUitOpen | 0:d42990d2724c | 33 | |
MikamiUitOpen | 0:d42990d2724c | 34 | TimerIsr(); |
MikamiUitOpen | 0:d42990d2724c | 35 | timer_.attach(&TimerIsr, 1); |
MikamiUitOpen | 0:d42990d2724c | 36 | |
MikamiUitOpen | 0:d42990d2724c | 37 | while (true) {} |
MikamiUitOpen | 0:d42990d2724c | 38 | } |
MikamiUitOpen | 1:3563f4c06d9e | 39 |