This project is read-only.

Toolbox.NETMF.Hardware.WiiNunchuk


Toolbox.NETMF.Hardware.WiiNunchuk(Address = 0x52, ClockRateKhz = 100)
  • Address The I²C identifier of the RTC module
  • ClockRateKhz The speed of the module

Methods

  • Read() Reads all values from the Nunchuk

Properties

  • AnalogStickX Analog stick X axis value
  • AnalogStickY Analog stick Y axis value
  • AcceleroMeterX Accelerometer X axis value
  • AcceleroMeterY Accelerometer Y axis value
  • AcceleroMeterZ Accelerometer Z axis value
  • ButtonC C-Button value
  • ButtonZ Z-Button value

How to connect

Toolbox.NETMF.Hardware.WiiNunchuk.png

Sample code in C#

WiiNunchuk Nunchuk = new WiiNunchuk();

while (true)
{
    // Reads all values
    Nunchuk.Read();

    // Prints out all values
    string Output = "Analog stick: " + Nunchuk.AnalogStickX.ToString() + "x" + Nunchuk.AnalogStickY.ToString();
    Output += " / Accellerometer: " + Nunchuk.AcceleroMeterX.ToString() + "x" + Nunchuk.AcceleroMeterY.ToString() + "x" + Nunchuk.AcceleroMeterZ.ToString();
    Output += " / C-Button: " + Nunchuk.ButtonC.ToString();
    Output += " / Z-Button: " + Nunchuk.ButtonZ.ToString();
    Debug.Print(Output);

    Thread.Sleep(1000);
}

Sample code in VB

Dim Nunchuk As WiiNunchuk = New WiiNunchuk()

Do
    ' Reads all values
    Nunchuk.Read()

    ' Prints out all values
    Dim Output As String = "Analog stick: " + Nunchuk.AnalogStickX.ToString() + "x" + Nunchuk.AnalogStickY.ToString()
    Output += " / Accellerometer: " + Nunchuk.AcceleroMeterX.ToString() + "x" + Nunchuk.AcceleroMeterY.ToString() + "x" + Nunchuk.AcceleroMeterZ.ToString()
    Output += " / C-Button: " + Nunchuk.ButtonC.ToString()
    Output += " / Z-Button: " + Nunchuk.ButtonZ.ToString()
    Debug.Print(Output)

    Thread.Sleep(1000)
Loop

Last edited May 27, 2012 at 10:40 PM by Garrcomm, version 2