The Electronics Nuke
/
mbed_lcd_custom
A sample program for custom character in lcd
main.cpp
- Committer:
- mbeded
- Date:
- 2014-07-03
- Revision:
- 1:e6f698c0d7af
- Parent:
- 0:310523b6696e
File content as of revision 1:e6f698c0d7af:
#include "mbed.h" #include "TextLCD.h" TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x2); int cur = 0; int mov = 1; char smile[] = {0,0,10,0,17,14,0,0}; char tongue[] = {0,0,10,0,17,14,2,0}; char hello[] = {4,12,30,31,17,17,14,0}; char comey[] = {0,0,30,31,21,17,14,0}; int main() { lcd.createChar(0, smile); lcd.createChar(1, hello); lcd.createChar(2, comey); lcd.createChar(7, tongue); while(1) { lcd.clear(); lcd.setCursor(cur,0); lcd.printf("BELLO"); lcd.setCursor(0,1); lcd.putc(0); lcd.setCursor(4,1); lcd.putc(1); cur = cur + mov; if(cur >= 11 || cur <= 0) mov = -mov; wait(1); lcd.clear(); lcd.setCursor(cur,0); lcd.printf("BELLO"); lcd.setCursor(0,1); lcd.putc(7); lcd.setCursor(4,1); lcd.putc(2); cur = cur + mov; if(cur >= 11 || cur <= 0) mov = -mov; wait(1); } }