A sample program for custom character in lcd
Fork of mbed_lcd_custom by
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 00004 TextLCD lcd(PTA13, PTD2, PTA4, PTA5, PTC8, PTC9, TextLCD::LCD16x2); // PARA PLACA KL46F 00005 00006 int cur = 0; 00007 int mov = 1; 00008 00009 char smile[] = {0,0,10,0,17,14,0,0}; 00010 char tongue[] = {0,0,10,0,17,14,2,0}; 00011 char hello[] = {4,12,30,31,17,17,14,0}; 00012 char comey[] = {0,0,30,31,21,17,14,0}; 00013 00014 int main() 00015 { 00016 lcd.createChar(0, smile); 00017 lcd.createChar(1, hello); 00018 lcd.createChar(2, comey); 00019 lcd.createChar(7, tongue); 00020 while(1) 00021 { 00022 lcd.clear(); 00023 lcd.setCursor(cur,0); 00024 lcd.printf("HOLA"); 00025 lcd.setCursor(0,1); 00026 lcd.putc(0); 00027 lcd.setCursor(4,1); 00028 lcd.putc(1); 00029 cur = cur + mov; 00030 if(cur >= 11 || cur <= 0) 00031 mov = -mov; 00032 wait(1); 00033 00034 lcd.clear(); 00035 lcd.setCursor(cur,1); 00036 lcd.printf("ADIOS"); 00037 lcd.setCursor(0,1); 00038 lcd.putc(7); 00039 lcd.setCursor(4,1); 00040 lcd.putc(2); 00041 cur = cur + mov; 00042 if(cur >= 11 || cur <= 0) 00043 mov = -mov; 00044 wait(1); 00045 } 00046 }
Generated on Wed Jul 20 2022 14:56:50 by 1.7.2