brian barreto
/
comunicacionserial
teclado matricial
Revision 0:5bb77c9df6c5, committed 2017-09-16
- Comitter:
- briandk
- Date:
- Sat Sep 16 22:00:19 2017 +0000
- Commit message:
- teclado m;
Changed in this revision
diff -r 000000000000 -r 5bb77c9df6c5 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Sat Sep 16 22:00:19 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r 5bb77c9df6c5 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Sep 16 22:00:19 2017 +0000 @@ -0,0 +1,69 @@ +#include "mbed.h" +#include "TextLCD.h" + + +int filas[5]={0,1,2,4,8}; +char tecla[6][6]; +int lectura; + +Serial pc(USBTX,USBRX); + +int main() +{ + TextLCD lcd(D10, D11, D12, D13, D14, D15, TextLCD::LCD16x2); + BusOut salida(D2,D3,D4,D5); + BusIn entrada(D6,D7,D8,D9); + +//primera fila +tecla[1][1]='1'; +tecla[1][2]='2'; +tecla[1][3]='3'; +tecla[1][4]='A'; + +//segunda fila +tecla[2][1]='4'; +tecla[2][2]='5'; +tecla[2][3]='6'; +tecla[2][4]='B'; + +//tercer fila +tecla[3][1]='7'; +tecla[3][2]='8'; +tecla[3][3]='9'; +tecla[3][4]='C'; + +//cuarta fila +tecla[4][1]='*'; +tecla[4][2]='0'; +tecla[4][3]='#'; +tecla[4][4]='D'; + +while(1) +{ + for(int o=1;o<5;o++) + { + + salida=filas[o]; + lectura=entrada.read(); + + if(lectura==1) + {lectura=1;} + if(lectura==2) + {lectura=2;} + if(lectura==4) + {lectura=3;} + if(lectura==8) + {lectura=4;} + + if(lectura!=0) + { + lcd.locate(0,0); + lcd.printf("IN: %c ",tecla[o][lectura]); + pc.printf("IN: %c ",tecla[o][lectura]); + + + wait(0.2); +} +} +} +}
diff -r 000000000000 -r 5bb77c9df6c5 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Sep 16 22:00:19 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/675da3299148 \ No newline at end of file