Created
June 2, 2020 11:44
-
-
Save mrstebo/8d2945f4cf20cec61dcc25109a4bc62f to your computer and use it in GitHub Desktop.
fez-panda-ii-with-matrix-keypad-3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using GHIElectronics.NETMF.FEZ; | |
| using Microsoft.SPOT; | |
| using Microsoft.SPOT.Hardware; | |
| using System; | |
| namespace Keypad_Test | |
| { | |
| public class Program | |
| { | |
| static Cpu.Pin[] ColumnPins = new[] | |
| { | |
| (Cpu.Pin)FEZ_Pin.Digital.Di22, | |
| (Cpu.Pin)FEZ_Pin.Digital.Di20, | |
| (Cpu.Pin)FEZ_Pin.Digital.Di24 | |
| }; | |
| static Cpu.Pin[] RowPins = new[] | |
| { | |
| (Cpu.Pin)FEZ_Pin.Digital.Di21, | |
| (Cpu.Pin)FEZ_Pin.Digital.Di26, | |
| (Cpu.Pin)FEZ_Pin.Digital.Di25, | |
| (Cpu.Pin)FEZ_Pin.Digital.Di23 | |
| }; | |
| static char[][] Keypad = new char[][] | |
| { | |
| new char[] { '1', '2', '3' }, | |
| new char[] { '4', '5', '6' }, | |
| new char[] { '7', '8', '9' }, | |
| new char[] { '*', '0', '#' } | |
| }; | |
| public static void Main() | |
| { | |
| try | |
| { | |
| var keypad = new Keypad(Keypad, RowPins, ColumnPins); | |
| keypad.HoldTime = 200; | |
| while (true) | |
| { | |
| var keys = keypad.GetKeys(); | |
| if(keys.Length > 0) | |
| Debug.Print(new string(keys)); | |
| } | |
| } | |
| catch (Exception ex) | |
| { | |
| Debug.Print("Error: " + ex.Message); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment