Frank Girald / Mbed 2 deprecated kbdlcdkl25z

Dependencies:   Keypad TextLCD mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 #include "Keypad.h"
00004 
00005 TextLCD lcd(PTE20,PTE21,PTE22,PTE23,PTE29,PTE30, TextLCD::LCD16x2); // Rs, E, d4, d5, d6, d7, RW=GND
00006 Keypad keypad(PTC4,PTC3,PTC0,PTC7,PTC11,PTC10,PTC6,PTC5); // c1, c2, c3, c4, f1, f2, f3, f4
00007 
00008 char key;
00009 int released=1;
00010 
00011 int main()
00012 {
00013     lcd.printf("Teclado y LCD");
00014     wait(1);
00015     lcd.cls();
00016 
00017     while (1) {
00018         key=keypad.ReadKey();
00019         if(key=='\0') released=1;
00020         if((key!='\0') && (released==1)) {
00021             lcd.locate(0,0);
00022             lcd.printf("Tecla Pulsada: %c",key);
00023             released=0;
00024         }
00025 
00026         wait(.1);
00027     }
00028 }