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-10-09
Revision:
10:b5b2b8035bbf
Parent:
9:dbeef6223e7a
Child:
11:c66fd440f283

File content as of revision 10:b5b2b8035bbf:

#include "mbed.h"
#include "TextLCD.h"
int main() {
    TextLCD lcd(PC_13, PC_14, PC_15, PA_0, PA_1, PA_2, 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);
}