Tarea 2. Con cualquier pulso del teclado, se acciona la salid a PWM de un Speaker, dejando fijo el ancho de pulso y la frecuencia.

Dependencies:   FPointer TextLCD keypad mbed

Files at this revision

API Documentation at this revision

Comitter:
Jesse
Date:
Mon Mar 31 21:27:14 2014 +0000
Commit message:
Tarea 2,Con cualquier tecla del teclado 4x4, Se acciona el encendido de un PWM para el accionamiento de un Speaker, dandole un valor de Frecuencia dado. con un ancho de pulso fijo.

Changed in this revision

FPointer.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
keypad.lib 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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 01487f2574c6 FPointer.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FPointer.lib	Mon Mar 31 21:27:14 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/AjK/code/FPointer/#56e309e76c19
diff -r 000000000000 -r 01487f2574c6 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Mon Mar 31 21:27:14 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/lcorralesc1/code/TextLCD/#0e0132807662
diff -r 000000000000 -r 01487f2574c6 keypad.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keypad.lib	Mon Mar 31 21:27:14 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/leorestrepo93/code/keypad/#e48ba5b4c497
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
diff -r 000000000000 -r 01487f2574c6 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Mar 31 21:27:14 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7d30d6019079
\ No newline at end of file