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.
keypad.cpp
00001 #include "main.h" 00002 00003 int getKeyNum(){ 00004 00005 DigitalIn col1(p18); 00006 DigitalIn col2(p20); 00007 DigitalIn col3(p16); 00008 00009 DigitalOut row1(p19); 00010 DigitalOut row2(p14); 00011 DigitalOut row3(p15); 00012 DigitalOut row4(p17); 00013 00014 row1 = 1; 00015 row2 = 0; 00016 row3 = 0; 00017 row4 = 0; 00018 00019 if (col1) 00020 return 1; 00021 else if (col2) 00022 return 2; 00023 else if (col3) 00024 return 3; 00025 00026 row1 = 0; 00027 row2 = 1; 00028 row3 = 0; 00029 row4 = 0; 00030 00031 if (col1) 00032 return 4; 00033 else if (col2) 00034 return 5; 00035 else if (col3) 00036 return 6; 00037 00038 row1 = 0; 00039 row2 = 0; 00040 row3 = 1; 00041 row4 = 0; 00042 00043 if (col1) 00044 return 7; 00045 else if (col2) 00046 return 8; 00047 else if (col3) 00048 return 9; 00049 00050 row1 = 0; 00051 row2 = 0; 00052 row3 = 0; 00053 row4 = 1; 00054 00055 if (col1) 00056 return -2; 00057 else if (col2) 00058 return 0; 00059 else if (col3) 00060 return -3; 00061 00062 row1 = 0; 00063 row2 = 0; 00064 row3 = 0; 00065 row4 = 0; 00066 00067 return -1; 00068 }
Generated on Fri Jul 15 2022 00:10:07 by
