manejo básico del teclado, usando la pantalla lcd.
Dependencies: FPointer TextLCD keypad mbed
Fork of Tarea3_Teclado_sonido by
main.cpp
00001 00002 #include "mbed.h" 00003 #include "keypad.h" 00004 #include "TextLCD.h" 00005 00006 TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7 00007 DigitalOut Sonido(PTB8); 00008 00009 PwmOut Pwm(PTA5); 00010 00011 00012 float pp=0.001; 00013 float Dd=0.1; 00014 char key,keyy; 00015 int C1=0x0F; 00016 00017 // Define your own keypad values 00018 char Keytable[] = { '1', '2', '3', 'A', 00019 '4', '5', '6', 'B', 00020 '7', '8', '9', 'C', 00021 '*', '0', '#', 'D' 00022 }; 00023 00024 00025 //PWM 00026 int PWMmodule(float pp,float Dd) 00027 { 00028 Pwm.period(pp); 00029 Pwm.write(Dd); 00030 wait(0.1); 00031 Pwm.write(0); 00032 return 0; 00033 } 00034 00035 uint32_t cbAfterInput(uint32_t Key) 00036 { 00037 00038 PWMmodule(pp,Dd); 00039 key=Key; 00040 lcd.locate(0,0); 00041 lcd.printf("%c",Keytable[key]); 00042 00043 return 0; 00044 } 00045 00046 int main() 00047 00048 { 00049 00050 00051 // r0 r1 r2 r3 c0 c1 c2 c3 00052 Keypad keypad(PTA2,PTD4,PTD3,PTD1,PTD2,PTD0,PTD5,PTA13); 00053 keypad.CallAfterInput(&cbAfterInput); 00054 keypad.Start(); 00055 00056 00057 while (1) 00058 { 00059 00060 } 00061 } 00062
Generated on Wed Jul 20 2022 23:18:32 by 1.7.2