Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Hotboards_keypad mbed
main.cpp
00001 00002 #include "mbed.h" 00003 #include "Hotboards_keypad.h" 00004 00005 // Se define el arreglo keys con su respectivo número de renglones 00006 // y columnas, y con el valor de cada una de las teclas 00007 char keys[ 4 ][ 4 ] = 00008 { 00009 { '1' , '2' , '3' , 'A' }, 00010 { '4' , '5' , '6' , 'B' }, 00011 { '7' , '8' , '9' , 'C' }, 00012 { '*' , '0' , '#' , 'D' } 00013 }; 00014 00015 // Se definen los pines que conectan a las filas 00016 DigitalInOut rowPins[ 4 ] = { PA_6 , PA_7 , PB_6 , PC_7 }; 00017 // Se definen los pines que conectan a las columnas 00018 DigitalInOut colPins[ 4 ] = { PA_8 , PB_10 , PB_4 , PB_5 }; 00019 00020 // Se crea un nuevo teclado con los valores anteriores 00021 Keypad kpd( makeKeymap( keys ) , rowPins , colPins , 4 , 4 ); 00022 00023 // Se configura el puerto serial 00024 Serial pc( USBTX , USBRX ); 00025 00026 int main() 00027 { 00028 while(1) 00029 { 00030 // Se pregunta por cualquier tecla presionada 00031 char key = kpd.getKey( ); 00032 00033 // Si se presiona una tecla "key" tendrá un valor diferente de cero 00034 if( key ) 00035 { 00036 // Se manda al puerto serial la tecla presionada 00037 pc.printf( "%c" , key ); 00038 pc.printf( "\n\r" ); 00039 } 00040 } 00041 }
Generated on Wed Jul 13 2022 21:45:23 by
1.7.2