Teclado y LCD 2x16
Dependencies: TextLCD keypad mbed
Revision 0:3a2f24d6afbd, committed 2017-04-24
- Comitter:
- franni
- Date:
- Mon Apr 24 22:20:06 2017 +0000
- Child:
- 1:faf520c1baac
- Commit message:
- Kl25z kbd lcd
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Mon Apr 24 22:20:06 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/keypad.lib Mon Apr 24 22:20:06 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/yoonghm/code/keypad/#da060f8c03e8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Apr 24 22:20:06 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/97feb9bacc10 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test1.cpp Mon Apr 24 22:20:06 2017 +0000 @@ -0,0 +1,46 @@ +#include "mbed.h" +#include "TextLCD.h" +#include "Keypad.h" + +//Serial PC(USBTX, USBRX); + +// Define your own keypad values +char Keytable[] = { '1', '2', '3', 'A', // r0 + '4', '5', '6', 'B', // r1 + '7', '8', '9', 'C', // r2 + '*', '0', '#', 'D' // r3 + }; // c0 c1 c2 c3 + +int32_t Index = -1; + +TextLCD lcd(PTE20,PTE21,PTE22,PTE23,PTE29,PTE30, TextLCD::LCD16x2); // Rs, E, d4, d5, d6, d7 + +uint32_t cbAfterInput(uint32_t _index) +{ + Index = _index; + return 0; +} + + + +int main() +{ + lcd.printf("Mi primer tecladito...\r\n"); + wait(1); + lcd.cls(); + lcd.locate(0,0); + + // r0 r1 r2 r3 c0 c1 c2 c3 + Keypad keypad(PTC9, PTC8, PTA5, PTA4, PTA12, PTD4, PTA1, PTA2); + keypad.attach(&cbAfterInput); + keypad.start(); // energiza columnas c0-c3 del keypad + + while (1) { + __wfi(); + if (Index > -1) { + lcd.printf("Key:%c\r\n",Keytable[Index]); + Index = -1; + } + wait(0.5); + } +} \ No newline at end of file