Trying to debug
Dependencies: mbed TextLCD keypad
Diff: keypadandlc.cpp
- Revision:
- 0:9b646298bdc9
- Child:
- 1:c57c18e1ca87
diff -r 000000000000 -r 9b646298bdc9 keypadandlc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/keypadandlc.cpp Wed Jan 30 02:34:25 2019 +0000 @@ -0,0 +1,31 @@ +#include "TextLCD.h" +#include "mbed.h" +#include "Keypad.h" +#include <string> + // Define your own keypad values + char Keytable[] = { '1', '2', '3', 'U', // r0 U = up + '4', '5', '6', 'D', // r1 D = down + '7', '8', '9', 'S', // r2 S = 2nd + 'C', '0', ',', 'E' // r3 C = clear, E = enter + }; + // c0 c1 c2 c3 + + uint32_t Index; + + uint32_t cbAfterInput(uint32_t index) { + Index = index; + return 0; + } + + int main() { + // r0 r1 r2 r3 c0 c1 c2 c3 + Keypad keypad(D0, D1, D2, D3, D10, D11, D12, D13); + keypad.attach(&cbAfterInput); + keypad.start(); // energize the keypad via c0-c3 + + while (1) { + __wfi(); + printf("Interrupted\r\n"); + printf("Index:%d => Key:%c\r\n", Index, Keytable[Index]); + } +} \ No newline at end of file