Skip to content

Instantly share code, notes, and snippets.

@mrstebo
Created June 2, 2020 11:44
Show Gist options
  • Select an option

  • Save mrstebo/8d2945f4cf20cec61dcc25109a4bc62f to your computer and use it in GitHub Desktop.

Select an option

Save mrstebo/8d2945f4cf20cec61dcc25109a4bc62f to your computer and use it in GitHub Desktop.
fez-panda-ii-with-matrix-keypad-3
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