LCD con teclado matricial

Fork of TextLCD by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
nikor97r
Date:
Sat Sep 23 20:40:16 2017 +0000
Parent:
8:308d188a2d3a
Commit message:
LCD CON TECLADO

Changed in this revision

TextLCD.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 308d188a2d3a -r db3c260474f6 TextLCD.h
--- a/TextLCD.h	Thu Jan 02 21:07:01 2014 +0000
+++ b/TextLCD.h	Sat Sep 23 20:40:16 2017 +0000
@@ -33,7 +33,7 @@
  * #include "mbed.h"
  * #include "TextLCD.h"
  * 
- * TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d4-d7
+ * TextLCD lcd(p10, p12, p15, p16, p29, p30); // s, e, d4-d7
  * 
  * int main() {
  *     lcd.printf("Hello World!\n");
diff -r 308d188a2d3a -r db3c260474f6 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Sep 23 20:40:16 2017 +0000
@@ -0,0 +1,69 @@
+#include "mbed.h"
+#include "TextLCD.h"
+Serial pc(USBTX,USBRX);
+char boton[5][5];
+TextLCD lcd(D2,D3,D4,D5,D6,D7);
+int main() 
+{
+    
+    boton[1][1]='1'; 
+    boton[2][1]='4';
+    boton[3][1]='7';
+    boton[4][1]='*';
+    boton[1][2]='2';
+    boton[2][2]='5';
+    boton[3][2]='8';
+    boton[4][2]='0';
+    boton[1][3]='3';
+    boton[2][3]='6';
+    boton[3][3]='9';
+    boton[4][3]='!';
+    boton[1][4]='h';
+    boton[2][4]='o';
+    boton[3][4]='l';
+    boton[4][4]='a';
+    while(1)
+    {
+    int filas[5] = {0,1,2,4,8};
+    int lectura;
+    int pos = 0;
+    BusOut sal(D8,D9,D10,D11);
+    BusIn ent(D12,D13,D14,D15);
+    while(1)
+    {
+        for(int i = 0; i < 5; i++)
+        {
+            sal=filas[i];
+            lectura = ent.read();
+            
+            if (lectura == 4)
+            {
+                lectura = 3;
+            }
+            if (lectura == 8)
+            {
+                lectura = 4;
+            }
+            if (lectura != 0)
+            {
+                if (pos == 15)
+                {
+                    lcd.cls();
+                    pos =0;
+                }
+                else{
+                lcd.locate(pos,0);
+                lcd.printf("%c",boton[i][lectura]); 
+                pc.printf("%c",boton[i][lectura]);
+                wait(0.5);
+                pos++;
+                }
+                
+            }
+            
+        }
+    
+    }
+    }
+}
+    
\ No newline at end of file