Manejo básico de teclado matricial 4x4 con LCD 16x02
Dependencies: Keypad keypad mbed
Diff: text.cpp
- Revision:
- 0:81bc4ffbdef6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/text.cpp Sun Jun 07 02:26:53 2015 +0000 @@ -0,0 +1,32 @@ +#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) {} +} + \ No newline at end of file