ANIS RASHID
/
xoxokey
KEYPAD USAHA SENDIRI.
Fork of 4x4KeyBoardExample by
main.cpp@0:c72d94fc465d, 2015-09-19 (annotated)
- Committer:
- rlanghbv
- Date:
- Sat Sep 19 08:09:26 2015 +0000
- Revision:
- 0:c72d94fc465d
- Child:
- 2:6b74f02a9e87
First Comit
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 |
rlanghbv | 0:c72d94fc465d | 9 | Keypad keypad( PC_3,PC_2,PA_0,PA_1,PA_4,PB_0,PC_1,PC_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 | } |