aliff

Dependencies:   TextLCD keypad mbed

Committer:
aliffhilmie93
Date:
Mon Jun 04 16:02:58 2018 +0000
Revision:
0:ee45a62491c4
pty aliff

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aliffhilmie93 0:ee45a62491c4 1 #include "mbed.h"
aliffhilmie93 0:ee45a62491c4 2 #include "keypad.h"
aliffhilmie93 0:ee45a62491c4 3 #include "TextLCD.h"
aliffhilmie93 0:ee45a62491c4 4
aliffhilmie93 0:ee45a62491c4 5 TextLCD lcd(D8, D9, D4, D5, D6, D7);
aliffhilmie93 0:ee45a62491c4 6
aliffhilmie93 0:ee45a62491c4 7
aliffhilmie93 0:ee45a62491c4 8 int main() {
aliffhilmie93 0:ee45a62491c4 9 // c0 c1 c2 c3 r0 r1 r2 r3
aliffhilmie93 0:ee45a62491c4 10 Keypad keypad( PC_3,PC_2,PC_0,PC_1,PC_5,PC_4,PB_1,PA_0 );
aliffhilmie93 0:ee45a62491c4 11
aliffhilmie93 0:ee45a62491c4 12 keypad.enablePullUp();
aliffhilmie93 0:ee45a62491c4 13 char key;
aliffhilmie93 0:ee45a62491c4 14 // lcd.printf(" ");
aliffhilmie93 0:ee45a62491c4 15 while (1)
aliffhilmie93 0:ee45a62491c4 16 {
aliffhilmie93 0:ee45a62491c4 17 key = keypad.getKey();
aliffhilmie93 0:ee45a62491c4 18 if(key != KEY_RELEASED)
aliffhilmie93 0:ee45a62491c4 19 {
aliffhilmie93 0:ee45a62491c4 20 lcd.locate (0,0);
aliffhilmie93 0:ee45a62491c4 21 lcd.printf("%c",key);
aliffhilmie93 0:ee45a62491c4 22 //wait(0.6);
aliffhilmie93 0:ee45a62491c4 23 }
aliffhilmie93 0:ee45a62491c4 24 if (key=='B')
aliffhilmie93 0:ee45a62491c4 25 {lcd.cls();
aliffhilmie93 0:ee45a62491c4 26 lcd.locate (0,0);
aliffhilmie93 0:ee45a62491c4 27 lcd.printf("BMT 4033");
aliffhilmie93 0:ee45a62491c4 28 }
aliffhilmie93 0:ee45a62491c4 29 if (key=='C')
aliffhilmie93 0:ee45a62491c4 30 {lcd.cls();
aliffhilmie93 0:ee45a62491c4 31 lcd.locate (0,0);
aliffhilmie93 0:ee45a62491c4 32 lcd.printf("Embedded");
aliffhilmie93 0:ee45a62491c4 33 }
aliffhilmie93 0:ee45a62491c4 34 if (key=='D')
aliffhilmie93 0:ee45a62491c4 35 {lcd.cls();
aliffhilmie93 0:ee45a62491c4 36 lcd.locate (0,0);
aliffhilmie93 0:ee45a62491c4 37 lcd.printf("System");
aliffhilmie93 0:ee45a62491c4 38 }
aliffhilmie93 0:ee45a62491c4 39 if (key=='E')
aliffhilmie93 0:ee45a62491c4 40 {lcd.cls();
aliffhilmie93 0:ee45a62491c4 41 lcd.locate (0,0);
aliffhilmie93 0:ee45a62491c4 42 lcd.printf("Design");
aliffhilmie93 0:ee45a62491c4 43 }
aliffhilmie93 0:ee45a62491c4 44 if (key=='F')
aliffhilmie93 0:ee45a62491c4 45 {lcd.cls();
aliffhilmie93 0:ee45a62491c4 46 lcd.locate (0,0);
aliffhilmie93 0:ee45a62491c4 47 lcd.printf("Score");
aliffhilmie93 0:ee45a62491c4 48 }
aliffhilmie93 0:ee45a62491c4 49 }
aliffhilmie93 0:ee45a62491c4 50 }