manejo básico del teclado, usando la pantalla lcd.

Dependencies:   FPointer TextLCD keypad mbed

Fork of Tarea3_Teclado_sonido by Julian Palacio

Revision:
0:01487f2574c6
Child:
1:4fa754f4522d
diff -r 000000000000 -r 01487f2574c6 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 31 21:27:14 2014 +0000
@@ -0,0 +1,78 @@
+//Jesse Mauricio Beltran Soto
+//Michelle Maceas Henao
+
+//Manejo Basico del Teclado Matcicial , teclado matricial
+
+#include "mbed.h"
+#include "keypad.h"
+#include "TextLCD.h"
+ 
+//Definicion de puertos de la LCD
+
+TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7
+
+//Defino Salidas Digitales
+DigitalOut myled(LED1);
+DigitalOut Sonido(PTB8);
+
+
+
+//Defino salida a Pwm
+PwmOut Pwm(PTA5);
+
+//Definicion de Variables
+ 
+float pp=0.001;
+float Dd=0.1;
+char key,keyy;
+int C1=0x0F;
+
+// Define your own keypad values
+char Keytable[] = { '1', '2', '3', 'A',
+                     '4', '5', '6', 'B',
+                      '7', '8', '9', 'C',
+                      '*', '0', '#', 'D'
+                    };
+ 
+ 
+//Funcion de PWM                   
+int PWMmodule(float pp,float Dd)
+{
+        Pwm.period(pp);
+        Pwm.write(Dd);
+        wait(0.1);
+        Pwm.write(0); 
+        return 0;
+}
+
+uint32_t cbAfterInput(uint32_t Key)
+{
+        
+        PWMmodule(pp,Dd);
+        key=Key;
+        lcd.locate(0,0);
+        lcd.printf("%c",Keytable[key]);
+            
+        return 0;
+}
+ 
+int main()
+
+{
+    //Configuracion de Pines:
+    //Filas van a Resistencia que van a tierra, y tambien a los puertos 
+    //Columnas van directamente a los pines de la tarjeta.
+    
+    //             r0   r1   r2   r3   c0   c1   c2   c3
+    Keypad keypad(PTA2,PTD4,PTD3,PTD1,PTD2,PTD0,PTD5,PTA13);
+    //keypad.attach(&cbAfterInput);
+    keypad.CallAfterInput(&cbAfterInput);
+    keypad.Start();  // energiza las columnas C0-C3 Del Keypad
+
+ 
+    while (1) 
+    {
+            
+    }
+}
+ 
\ No newline at end of file