![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
keypad
Revision 0:208c883dc5fa, committed 2014-03-06
- Comitter:
- redplam
- Date:
- Thu Mar 06 02:56:45 2014 +0000
- Commit message:
- keypad
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Thu Mar 06 02:56:45 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/keypad.cpp Thu Mar 06 02:56:45 2014 +0000 @@ -0,0 +1,158 @@ +#include "mbed.h" +#define BAUDRATE0 1200 +Serial pc(PTE20,PTE21); +//#include "TextLCD.h" + +BusIn colonne(PTC6,PTC5,PTC4,PTC3,PTC0,PTC7); +BusOut righe(PTA1,PTA2,PTA12,PTA4,PTA5); +//TextLCD lcd(PTE5,PTE4,PTE3,PTE2,PTB11,PTB10); + +char Keypad(void) +{ + char key = 100; + // righe.write(31);//11111 + // switch(colonne) { + // case 31: + // key = 1; + // break;//011111 + // case 47: + // key = 2; + // break;//101111 + // case 55: + // key = 3; + // break;//110111 + // case 59: + // key = 4; + // break;//111011 + // case 61: + // key = 5; + // break;//111101 + // case 62: + // key = 6; + // break;//111110 + // } + righe.write(30);//11110 + switch(colonne) { + case 31: + key = 7; + break;//011111 + case 47: + key = 8; + break;//101111 + case 55: + key = 9; + break;//110111 + case 59: + key = 10; + break;//111011 + case 61: + key = 11; + break;//111101 + case 62: + key = 12; + break;//111110 + } + righe.write(29); + switch(colonne) { + case 31: + key = 13; + break;//011111 + case 47: + key = 14; + break;//101111 + case 55: + key = 15; + break;//110111 + case 59: + key = 16; + break;//111011 + case 61: + key = 17; + break;//111101 + case 62: + key = 18; + break;//111110 + } + righe.write(27);//11011 + switch(colonne) { + case 31: + key = 19; + break;//011111 + case 47: + key = 20; + break;//101111 + case 55: + key = 21; + break;//110111 + case 59: + key = 22; + break;//111011 + case 61: + key = 23; + break;//111101 + case 62: + key = 24; + break;//111110 + } + righe.write(23);//10111 + switch(colonne) { + case 31: + key = 25; + break;//011111 + case 47: + key = 26; + break;//101111 + case 55: + key = 27; + break;//110111 + case 59: + key = 28; + break;//111011 + case 61: + key = 29; + break;//111101 + case 62: + key = 30; + break;//111110 + } + righe.write(15);//01111 + switch(colonne) { + case 31: + key = 31; + break;//011111 + case 47: + key = 32; + break;//101111 + case 55: + key = 33; + break;//110111 + case 59: + key = 34; + break;//111011 + case 61: + key = 35; + break;//111101 + case 62: + key = 36; + break;//111110 + } + return key; +} + +int main(void) +{ + pc.baud( BAUDRATE0 ); + char key; + // lcd.cls(); + while(1) { + // lcd.cls(); + // key = Keypad(); + pc.printf("k\n"); + // if(key != 100) { + // pc.printf("keypad = %f\n", key); + // + } + // lcd.printf("%c\n\r",&key); + wait(0.2); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 06 02:56:45 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1 \ No newline at end of file