Toolbox.NETMF.Hardware.WearableKeypad


Toolbox.NETMF.Hardware.WearableKeypad(Pin1, Pin2, Pin3)
  • Pin1 Pin P5.1 from the keypad
  • Pin2 Pin P5.2 from the keypad
  • Pin3 Pin P5.3 from the keypad

Methods

  • Read() Returns the pressed button or 0 when no button is pressed (1 = up, 2 = right, 3 = down, 4 = left, 5 = logo)
  • Dispose() Frees the pins

How to connect

Toolbox.NETMF.Hardware.WearableKeypad.png

Sample code in C#

WearableKeypad Keypad = new WearableKeypad(Pins.GPIO_PIN_D5, Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D6);
while (true)
{
    switch (Keypad.Read())
    {
        case 0: Debug.Print("Up"); break;
        case 1: Debug.Print("Right"); break;
        case 2: Debug.Print("Down"); break;
        case 3: Debug.Print("Left"); break;
        case 4: Debug.Print("Center"); break;
    }
    Thread.Sleep(100);
}

Sample code in VB

Dim Keypad As WearableKeypad = New WearableKeypad(Pins.GPIO_PIN_D5, Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D6)

Do
    Select Case Keypad.Read()
        Case 0 : Debug.Print("Up")
        Case 1 : Debug.Print("Right")
        Case 2 : Debug.Print("Down")
        Case 3 : Debug.Print("Left")
        Case 4 : Debug.Print("Center")
    End Select

    Thread.Sleep(100)
Loop

Related documents

Last edited Jan 1, 2013 at 8:21 PM by Garrcomm, version 3