Demo program of library for LCD ACM1602NI connected using I2C interface on Nucleo F401/411. Nucleo F401/411RE で使える I2C 接続の LCD ACM1602NI 用のライブラリの使用例.

Dependencies:   ACM1602NI_NucleoF4 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 //------------------------------------------------------------
00002 // Demo program for LCD ACM1602NI using I2C interface.
00003 //      Pullup resistors for SDA and SCL: 4.7 kΩ.
00004 //  Product name of LCD: ACM1602NI-FLW-FBW-M01
00005 //  See http://akizukidenshi.com/catalog/g/gP-05693/
00006 //
00007 //  2014/12/14, Copyright (c) 2014 MIKAMI, Naoki
00008 //------------------------------------------------------------
00009 
00010 //#include "mbed.h"
00011 #include "ACM1602NI.hpp"
00012 using namespace Mikami;
00013 
00014 Acm1602Ni lcd_;                               // Default, OK
00015 //Acm1602Ni lcd_(D14, D15);                     // OK
00016 //Acm1602Ni lcd_(D14, D15, 200000);             // OK
00017 //Acm1602Ni lcd_(D14, D15, 200000, true, true); // OK
00018 //Acm1602Ni lcd_(PB_3, PB_10);                  // OK
00019 //Acm1602Ni lcd_(PC_9, PA_8);                   // OK
00020 //Acm1602Ni lcd_(PB_4, PA_8);                   // OK 
00021 
00022 Ticker timer_;
00023 
00024 // Display 0, 1, 2, .....
00025 void TimerIsr()
00026 {
00027     static int k = 0;
00028     int sec = k % 60;   // seconds
00029     int min = k / 60;   // minits
00030     char str[20];
00031     sprintf(str, "%d'%2d\"", min, sec);
00032     lcd_.WriteStringXY(str, 0, 1);
00033     k++;
00034 }
00035 
00036 int main()
00037 {
00038     lcd_.Clear();
00039     lcd_.WriteString("Hello World!");
00040 
00041     TimerIsr();
00042     timer_.attach(&TimerIsr, 1);
00043 
00044     while (true) {}
00045 }