Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:5bb77c9df6c5
--- /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);
+}
+}
+}
+}