aliff

Dependencies:   TextLCD keypad mbed

main.cpp

Committer:
aliffhilmie93
Date:
2018-06-04
Revision:
0:ee45a62491c4

File content as of revision 0:ee45a62491c4:

#include "mbed.h"
#include "keypad.h"
#include "TextLCD.h"
 
TextLCD lcd(D8, D9, D4, D5, D6, D7);

 
int main() {
                //  c0   c1   c2   c3  r0   r1   r2   r3    
    Keypad keypad( PC_3,PC_2,PC_0,PC_1,PC_5,PC_4,PB_1,PA_0 );
       
    keypad.enablePullUp();
    char key;
//    lcd.printf(" ");
    while (1) 
    {
         key = keypad.getKey();    
         if(key != KEY_RELEASED)
         {
            lcd.locate (0,0);
            lcd.printf("%c",key);
            //wait(0.6);
         }
             if (key=='B')
         {lcd.cls();
             lcd.locate (0,0);
             lcd.printf("BMT 4033");
             }
             if (key=='C')
         {lcd.cls();
             lcd.locate (0,0);
             lcd.printf("Embedded");
             }
             if (key=='D')
         {lcd.cls();
             lcd.locate (0,0);
             lcd.printf("System");
             }
             if (key=='E')
         {lcd.cls();
             lcd.locate (0,0);
             lcd.printf("Design");
             }
             if (key=='F')
         {lcd.cls();
             lcd.locate (0,0);
             lcd.printf("Score");
             }
}
}