ANIS RASHID
/
xoxokey
KEYPAD USAHA SENDIRI.
Fork of 4x4KeyBoardExample by
main.cpp@2:6b74f02a9e87, 2018-05-17 (annotated)
- Committer:
- fitri
- Date:
- Thu May 17 07:48:58 2018 +0000
- Revision:
- 2:6b74f02a9e87
- Parent:
- 0:c72d94fc465d
KEYPAD SAJA;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rlanghbv | 0:c72d94fc465d | 1 | #include "mbed.h" |
rlanghbv | 0:c72d94fc465d | 2 | #include "keypad.h" |
rlanghbv | 0:c72d94fc465d | 3 | |
rlanghbv | 0:c72d94fc465d | 4 | Serial pc(USBTX, USBRX); |
rlanghbv | 0:c72d94fc465d | 5 | |
rlanghbv | 0:c72d94fc465d | 6 | |
rlanghbv | 0:c72d94fc465d | 7 | int main() { |
rlanghbv | 0:c72d94fc465d | 8 | // c0 c1 c2 c3 r0 r1 r2 r3 |
fitri | 2:6b74f02a9e87 | 9 | Keypad keypad( PC_3,PC_2,PC_0,PC_1,PC_5,PC_4,PB_1,PA_0 ); |
rlanghbv | 0:c72d94fc465d | 10 | |
rlanghbv | 0:c72d94fc465d | 11 | keypad.enablePullUp(); |
rlanghbv | 0:c72d94fc465d | 12 | char key; |
rlanghbv | 0:c72d94fc465d | 13 | pc.printf("Please touch a key on the keypad\n\r"); |
rlanghbv | 0:c72d94fc465d | 14 | while (1) |
rlanghbv | 0:c72d94fc465d | 15 | { |
rlanghbv | 0:c72d94fc465d | 16 | key = keypad.getKey(); |
rlanghbv | 0:c72d94fc465d | 17 | if(key != KEY_RELEASED) |
rlanghbv | 0:c72d94fc465d | 18 | { |
rlanghbv | 0:c72d94fc465d | 19 | pc.printf("%c\r\n",key); |
rlanghbv | 0:c72d94fc465d | 20 | wait(0.6); |
rlanghbv | 0:c72d94fc465d | 21 | } |
rlanghbv | 0:c72d94fc465d | 22 | } |
rlanghbv | 0:c72d94fc465d | 23 | } |