keypad kullanimi
Dependencies: mbed TextLCD keypad
Diff: main.cpp
- Revision:
- 0:81aa7be5b5cb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Dec 04 11:59:18 2019 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" +#include "TextLCD.h" +#include "Keypad.h" +TextLCD lcd(PB_0,PA_4,PC_3,PC_2,PB_3,PA_10); + + + // 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 + + uint32_t Index; + + uint32_t cbAfterInput(uint32_t index) { + Index = index; + lcd.cls(); + lcd.printf("Basilan Tus:%c",Keytable[Index]); + return 0; + } + + int main() { + // r0 r1 r2 r3 c0 c1 c2 c3 + Keypad keypad(PC_12, PC_10, PC_11,PD_2,PA_13,PA_14,PA_15,PC_8); + keypad.attach(&cbAfterInput); + keypad.start(); // energize the keypad via c0-c3 + + while (1) { + //__wfi(); +wait(100); + } + }