Manejo básico de teclado matricial 4x4 con LCD 16x02

Dependencies:   Keypad keypad mbed

text.cpp

Committer:
RafaB
Date:
2015-06-07
Revision:
0:81bc4ffbdef6

File content as of revision 0:81bc4ffbdef6:

#include "mbed.h"
#include "Keypad.h" 
#include "TextLCD.h"
 
TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7
char key;

// Define your own keypad values
char Keytable[] = { '1', '2', '3', 'A',
                    '4', '5', '6', 'B',
                    '7', '8', '9', 'C',
                    '*', '0', '#', 'D'
                    };
 
uint32_t cbAfterInput(uint32_t Key)
{       lcd.locate(0,0);
        lcd.printf("La tecla es: ");
        key=Key;
        lcd.locate(0,14);
        lcd.printf("%c",Keytable[key]);   
        return 0;
}
 
int main(){
    //             F0    F1     F2     F3     C0    C1     C2     C3
    Keypad keypad(PTA1,PTA2,PTD4,PTA12,PTA4,PTA5,PTC8,PTC9);
    keypad.CallAfterInput(&cbAfterInput);
    keypad.Start();  
 
    while (true) {}
}