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.
key_3x4.cpp
00001 /* 00002 * Mbed Application program 00003 * example: 00004 * Akizuki AE-KIT45-KEYPAD4X3 00005 * http://akizukidenshi.com/catalog/g/gK-12229/ 00006 * 00007 * Copyright (c) 2017,'20 Kenji Arai / JH1PJL 00008 * http://www7b.biglobe.ne.jp/~kenjia/ 00009 * https://os.mbed.com/users/kenjiArai/ 00010 * Created: September 27th, 2017 00011 * Revised: April 13th, 2020 00012 */ 00013 00014 // Pre-selection -------------------------------------------------------------- 00015 #include "select_example.h" 00016 //#define KEY3X4 00017 #ifdef KEY3X4 00018 00019 // Include -------------------------------------------------------------------- 00020 #include "mbed.h" 00021 #include "Keypad.h" 00022 00023 // Definition ----------------------------------------------------------------- 00024 00025 // Object --------------------------------------------------------------------- 00026 DigitalOut my_led(LED1); 00027 Serial pc(USBTX,USBRX); 00028 // X Y Z A B C D OUT(XYZ), IN(ABCD) 00029 Keypad key(D11, D10, D9, D6, D5, D4, D3); 00030 00031 // RAM ------------------------------------------------------------------------ 00032 00033 // ROM / Constant data -------------------------------------------------------- 00034 // X*A = *, X*B = 7, X*C = 4, X*D = 1 00035 // Y*A = 0, Y*B = 8, Y*C = 5, Y*D = 2 00036 // Z*A = #, Z*B = 9, Z*C = 6, Z*D = 3 00037 // key_table[0]=? is not used! 00038 const char *const key_table = "?*7410852#963"; 00039 // 123456789012 00040 00041 // Function prototypes -------------------------------------------------------- 00042 00043 //------------------------------------------------------------------------------ 00044 // Control Program 00045 //------------------------------------------------------------------------------ 00046 int main() 00047 { 00048 uint32_t key_num; 00049 uint32_t counter = 0; 00050 00051 pc.printf("Start Key-Pad test 3x4 keys\r\n"); 00052 while(true) { 00053 while ((key_num = key.read()) != 0) { 00054 pc.printf("%2u:[%2d] %c\r\n", 00055 counter++, key_num, *(key_table + key_num)); 00056 } 00057 wait_us(100000); 00058 } 00059 } 00060 00061 #endif // #ifdef KEY3X4
Generated on Wed Jul 13 2022 01:19:28 by
1.7.2