soalan 3
Dependencies: KeypadLib TextLCD mbed
Fork of KEYPADLCDMAIN by
Diff: main.cpp
- Revision:
- 4:39560eaa4025
- Parent:
- 3:f973bf5ad35d
diff -r f973bf5ad35d -r 39560eaa4025 main.cpp --- a/main.cpp Thu May 17 08:13:54 2018 +0000 +++ b/main.cpp Mon Jun 04 14:31:06 2018 +0000 @@ -2,7 +2,7 @@ #include "keypad.h" #include "TextLCD.h" -Serial pc(USBTX, USBRX); + TextLCD lcd(D8, D9, D4, D5, D6, D7); @@ -12,17 +12,24 @@ keypad.enablePullUp(); char key; - lcd.printf("key ="); - pc.printf("Please touch a key on the keypad\n\r"); + // lcd.printf("key ="); while (1) { key = keypad.getKey(); if(key != KEY_RELEASED) { - lcd.locate (4,1); + lcd.locate (7,1); lcd.printf("%c",key); - pc.printf("%c\r\n",key); + wait(0.6); } + key = keypad.getKey(); + if(key != KEY_RELEASED) + { + lcd.locate (1,0); + lcd.printf("BMT 4033",key); + + wait(0.6); + } } } \ No newline at end of file