Teclado matricial con sonido
Dependencies: FPointer TextLCD keypad mbed
Fork of Tarea3_Teclado by
main.cpp
- Committer:
- Jepalacioh
- Date:
- 2014-04-23
- Revision:
- 1:4fa754f4522d
- Parent:
- 0:01487f2574c6
File content as of revision 1:4fa754f4522d:
//Julian Esteban Palacio Hernandez //Andres Mauricio Gomez Arevalo #include "mbed.h" #include "keypad.h" //Librería de manejo de Teclado #include "TextLCD.h"//Librería de LCD TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7 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) { } }