syakir shamsudin / Mbed 2 deprecated KEYPADLCDtest

Dependencies:   KeypadLib TextLCD mbed

Fork of KEYPADLCDMAIN by fitri ariffin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "keypad.h"
00003 #include "TextLCD.h"
00004  
00005 
00006 TextLCD lcd(D8, D9, D4, D5, D6, D7);
00007 
00008  
00009 int main() {
00010                 //  c0   c1   c2   c3  r0   r1   r2   r3    
00011     Keypad keypad( PC_3,PC_2,PC_0,PC_1,PC_5,PC_4,PB_1,PA_0 );
00012        
00013     keypad.enablePullUp();
00014     char key;
00015    // lcd.printf("key =");
00016     while (1) 
00017     {
00018          key = keypad.getKey();    
00019          if(key != KEY_RELEASED)
00020          {
00021               lcd.locate (7,1);
00022              lcd.printf("%c",key);
00023              
00024              wait(0.6);
00025          }
00026          key = keypad.getKey();    
00027          if(key != KEY_RELEASED)
00028          {
00029               lcd.locate (1,0);
00030              lcd.printf("BMT 4033",key);
00031              
00032              wait(0.6);
00033     }
00034     }
00035 }