TextLCD library for controlling various LCD panels based on the HD44780 4-bit interface

Dependencies:   mbed

Fork of TextLCD by Simon Ford

main.cpp

Committer:
zhangyx
Date:
2017-07-07
Revision:
9:dbeef6223e7a
Child:
10:b5b2b8035bbf

File content as of revision 9:dbeef6223e7a:

#include "mbed.h"
#include "TextLCD.h"
int main() {
    TextLCD lcd(A5, A4, A3, A2, A1, A0, TextLCD::LCD20x4); // rs, e, d4-d7, model
    
    lcd.printf("Hello World!");
    wait_ms(1000); //等待1秒
    lcd.cls(); //清屏
    
    for(int i=0; i<10000; i+=4){
        lcd.locate(0,0); //分别控制起始的列和行,从0开始
        lcd.printf("%d", i);
        wait_ms(1000); //等待1秒
        
        lcd.locate(0,1);
        lcd.printf("%d", i+1);
        wait_ms(1000);
        
        lcd.locate(0,2);
        lcd.printf("%d", i+2);
        wait_ms(1000);
        
        lcd.locate(0,3);
        lcd.printf("%d", i+3);
        wait_ms(1000);
        
        lcd.cls(); //清屏
    }

    while(1);
}