soalan 3

Dependencies:   KeypadLib TextLCD mbed

Fork of KEYPADLCDMAIN by fitri ariffin

Files at this revision

API Documentation at this revision

Comitter:
syakir93
Date:
Mon Jun 04 14:31:06 2018 +0000
Parent:
3:f973bf5ad35d
Commit message:
soalan 3;

Changed in this revision

KeypadLib.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/KeypadLib.lib	Thu May 17 08:13:54 2018 +0000
+++ b/KeypadLib.lib	Mon Jun 04 14:31:06 2018 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/fitri/code/KeypadLib/#8909e7419412
+https://os.mbed.com/users/syakir93/code/KeypadLib/#a09fc75f4ca7
--- 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