Demo program of UIT_ACM1602NI for use LCD on NucleoF401.

Dependencies:   UIT_ACM1602NI mbed

main.cpp

Committer:
MikamiUitOpen
Date:
2015-01-17
Revision:
7:6b9baf26a109
Parent:
6:8f5c84d52659
Child:
8:3f9bc6437cb8

File content as of revision 7:6b9baf26a109:

//------------------------------------------------------------
// Demo program for LCD ACM1602NI using I2C interface
//      Pullup resistors for SDA and SCL: 4.7 kΩ
// 2015/01/17, Copyright (c) 2015 MIKAMI, Naoki
//------------------------------------------------------------

#include "ACM1602NI.hpp"
using namespace Mikami;

Acm1602Ni lcd_;                               // Default, OK
//Acm1602Ni lcd_(D14, D15);                     // OK
//Acm1602Ni lcd_(D14, D15, 200000);             // OK
//Acm1602Ni lcd_(D14, D15, 200000, true, true); // OK
//Acm1602Ni lcd_(PB_3, PB_10);                  // OK
//Acm1602Ni lcd_(PC_9, PA_8);                   // OK
//Acm1602Ni lcd_(PB_4, PA_8);                   // OK 

Ticker timer_;

// Display elapsed time in minutes and seconds
void TimerIsr()
{
    static int k = 0;
    int sec = k % 60;   // seconds
    int min = k / 60;   // minits
    char str[20];
    sprintf(str, "%d'%2d\"", min, sec);
    lcd_.WriteStringXY(str, 0, 1);
    k++;
}

int main()
{
    lcd_.WriteString("Hello World!");

    TimerIsr();
    timer_.attach(&TimerIsr, 1);

    while (true) {}
}