This project is read-only.


Toolbox.NETMF.Hardware.NESControllerAdapter(Clk, Latch, Data1, Data2)
  • Clk The pin matching the "Clk" on the NES Controller Board (SPI SCLK)
  • Latch The pin matching the "Latch" on the NES Controller Board (SPI SS)
  • Data1 The pin matching the "Data1" on the NES Controller Board (SPI MISO)
  • Data2 The pin matching the "Data2" on the NES Controller Board (SPI MISO)


  • ButtonState(Socket, Button) Returns the state of a single button
  • Dispose() Disposes the object, freeing all related pins
  • Read(Socket1, Socket2) Reads the sockets
  • SocketConnected(Socket) Returns the state of a socket


  • EventsEnabled When set to true, the events will work


  • OnButtonChanged(This, Socket, Button, Value, Time) Triggered when a button changes
  • OnSocketChanged(This, Socket, ButtonStates, Time) Triggered when a socket changes

How to connect


Sample code in C#

public static void Main()
    NESControllerAdapter Controller = new NESControllerAdapter(Pins.GPIO_PIN_A2, Pins.GPIO_PIN_A3, Pins.GPIO_PIN_A4, Pins.GPIO_PIN_A5);
    Controller.OnButtonChanged += new NESControllerAdapter.ButtonChanged(Controller_OnButtonChanged);
    Controller.EventsEnabled = true;


static void Controller_OnButtonChanged(NESControllerAdapter This, NESControllerAdapter.Socket Socket, NESControllerAdapter.Button Button, bool Value, DateTime Time)
    Debug.Print("Button " + Button.ToString()+" on Socket " + Socket.ToString() + " changed to " + Value.ToString());

Sample code in VB

Dim WithEvents Controller As NESControllerAdapter = New NESControllerAdapter(Pins.GPIO_PIN_A2, Pins.GPIO_PIN_A3, Pins.GPIO_PIN_A4, Pins.GPIO_PIN_A5)

Sub Main()
    Controller.EventsEnabled = True
End Sub

Private Sub Controller_OnButtonChanged(This As Toolbox.NETMF.Hardware.NESControllerAdapter, Socket As Toolbox.NETMF.Hardware.NESControllerAdapter.Socket, Button As Toolbox.NETMF.Hardware.NESControllerAdapter.Button, Value As Boolean, Time As Date) Handles Controller.OnButtonChanged
    Debug.Print("Button " + Button.ToString() + " on Socket " + Socket.ToString() + " changed to " + Value.ToString())
End Sub

Related documents

Last edited Jan 2, 2013 at 7:05 PM by Garrcomm, version 1