keypad corretto controllare il debounce

Dependencies:   TextLCD keypad mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 #include "keypad.h"
00004 
00005 
00006 
00007 TextLCD lcd(D2,D3,D4,D5,D6,D7); 
00008 
00009 Keypad telepad(PA_0 , PA_1 , PA_4 , PB_0,PA_13 , PA_14 , PC_2 , PC_3 );
00010 
00011 
00012 int main() {
00013     lcd.locate(0,0);
00014     lcd.printf("KeyBoard: ");
00015     char key;
00016     while(1){
00017         lcd.locate(0,1);
00018         key = telepad.getKey(); 
00019         if(key != KEY_RELEASED){
00020             lcd.printf( "%c" , key);
00021             wait(0.6);
00022         }else{
00023             lcd.printf( "%c" , ' ');
00024         }
00025     }
00026 }