TextLCD library for controlling various LCD panels based on the HD44780 4-bit interface
Fork of TextLCD by
Diff: main.cpp
- Revision:
- 9:dbeef6223e7a
- Child:
- 10:b5b2b8035bbf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jul 07 15:27:16 2017 +0000 @@ -0,0 +1,31 @@ +#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); +}