Toyomasa Watarai / Mbed 2 deprecated PCF8576_GH08172_test

Dependencies:   PCF8576 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002  * PCF8576 + GH08172 LCD test program
00003  */
00004 
00005 #include "mbed.h"
00006 #include "PCF8576.h"
00007 
00008 PCF8576 lcd(D14, D15);
00009 Ticker flipper;
00010 
00011 void blink()
00012 {
00013     static uint32_t cnt = 0;
00014     const uint32_t ptn[5] = {0, 1, 3, 7, 0xF};
00015 
00016     if (cnt > 4) {
00017         cnt = 0;
00018     }
00019     lcd.icon(ptn[cnt++]);
00020 }
00021 
00022 int main()
00023 {
00024     char buf[6];    
00025     flipper.attach(&blink, 0.4);
00026 
00027     lcd.print("mbed");
00028     wait(5);
00029 
00030     int cnt = 0;
00031     while(1) {
00032         sprintf(buf, "%6d", cnt++);
00033         lcd.print(buf);
00034         wait(0.1);
00035     }
00036 }