CRISTIAN YOMAYUZA
/
Teclado_lcd
Teclado con lcd
Diff: main.cpp
- Revision:
- 0:2b5a34cdd26d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Sep 16 21:55:50 2017 +0000 @@ -0,0 +1,36 @@ +#include "mbed.h" +#include "TextLCD.h" +int filas[5]={0,1,2,4,8}; +char tecla[6][6]; +int lectura; +TextLCD yoma (D10,D11,D12,D13,D14,D15); +int count, rowM=0; +Serial pc(USBTX,USBRX); +int main() +{ + yoma.locate(0,0); + BusOut salida(D2,D3,D4,D5); + BusIn entrada(D6,D7,D8,D9); + tecla[1][1]='1';tecla[1][2]='2';tecla[1][3]='3';tecla[1][4]='A'; + tecla[2][1]='4';tecla[2][2]='5';tecla[2][3]='6';tecla[2][4]='B'; + tecla[3][1]='7';tecla[3][2]='8';tecla[3][3]='9';tecla[3][4]='C'; + 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) + { + + //yoma.printf("1"); + yoma.printf("entrada: %c \n\r",tecla[o][lectura]); + wait(0.2); + + } + } + } +} \ No newline at end of file