Programa Teclao y LCD

Dependencies:   Keypad TextLCD mbed

main.cpp

Committer:
franni
Date:
2017-04-27
Revision:
0:52ff9a225855

File content as of revision 0:52ff9a225855:

#include "mbed.h"
#include "TextLCD.h"
#include "Keypad.h"

TextLCD lcd(PTE20,PTE21,PTE22,PTE23,PTE29,PTE30, TextLCD::LCD16x2); // Rs, E, d4, d5, d6, d7, RW=GND
Keypad keypad(PTC4,PTC3,PTC0,PTC7,PTC11,PTC10,PTC6,PTC5); // c1, c2, c3, c4, f1, f2, f3, f4

char key;
int released=1;

int main()
{
    lcd.printf("Teclado y LCD");
    wait(1);
    lcd.cls();

    while (1) {
        key=keypad.ReadKey();
        if(key=='\0') released=1;
        if((key!='\0') && (released==1)) {
            lcd.locate(0,0);
            lcd.printf("Tecla Pulsada: %c",key);
            released=0;
        }

        wait(.1);
    }
}