Tests forked Keypad library.
Dependencies: FPointer keypad mbed
Schematic:
No extra hardware is needed besides the wires and switches. The columns are outputs configured with open drain. The rows are inputs configured with pull up resistors. A key press pulls down its row. With scanning the column is determined thereafter.
See keypad for the forked library used in this project.
Diff: main.cpp
- Revision:
- 2:eaa3d23e9b29
- Parent:
- 1:8bbe2b267de6
- Child:
- 3:fb173f712440
--- a/main.cpp Sat Nov 03 21:48:39 2012 +0000 +++ b/main.cpp Sat Nov 03 23:45:20 2012 +0000 @@ -28,10 +28,24 @@ printf("*** Keypad Demo ***\n"); Keypad keypad(p25, p26, p27, p28, p21, p22, p23, p24); + +// interrupt mode keypad.CallAfterInput(&cbAfterInput); - keypad.Start(); while (1) { Sleep(); } + +// polling mode +/* + keypad.Start(); + + int key = -1; + while (1) { + key = keypad.DebouncedScan(); + if (key >= 0) + cbAfterInput(key); + wait(0.1); + } +*/ } \ No newline at end of file