Main Site Documentation

Mini and Wii controller


#1

Having trouble getting Wii nunchuck working. Have Mini with robot board. Connected SDA on wii to A4 on robot board and SCL to A5 per directions. Run program and x,y never updates and keep getting this output in a loop. I assume it is something I have not done, but don’t what to look at. tia

GC: 3msec 18384 bytes used, 45996 bytes available
Type 0F (STRING ): 144 bytes
Type 11 (CLASS ): 2220 bytes
Type 12 (VALUETYPE ): 84 bytes
Type 13 (SZARRAY ): 612 bytes
Type 15 (FREEBLOCK ): 45996 bytes
Type 17 (ASSEMBLY ): 10068 bytes
Type 18 (WEAKCLASS ): 48 bytes
Type 19 (REFLECTION ): 24 bytes
Type 1B (DELEGATE_HEAD ): 252 bytes
Type 1D (OBJECT_TO_EVENT ): 312 bytes
Type 1E (BINARY_BLOB_HEAD ): 276 bytes
Type 1F (THREAD ): 768 bytes
Type 20 (SUBTHREAD ): 96 bytes
Type 21 (STACK_FRAME ): 1260 bytes
Type 22 (TIMER_HEAD ): 216 bytes
Type 27 (FINALIZER_HEAD ): 264 bytes
Type 31 (IO_PORT ): 252 bytes
Type 33 (I2C_XACTION ): 48 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
Type 36 (APPDOMAIN_ASSEMBLY ): 1368 bytes
Analog X: 0 Analog Y: 0

// Code
public static void WII()
{
    try
    {
        FEZ_Components.Wii.Nunchuk.Initialize();
        bool connected = FEZ_Components.Wii.Nunchuk.Connected;
        Debug.Print("Connected:" + connected);
        while (true)
        {
            var x = FEZ_Components.Wii.Nunchuk.AnalogStickX;
            var y = FEZ_Components.Wii.Nunchuk.AnalogStickY;
            string s = "Analog X: " + x + " Analog Y: " + y;
            Debug.Print(s);
            Thread.Sleep(2000);
        }
    }
    catch (Exception ex)
    {
        Debug.Print(ex.Message);
    }
}

#2

Please code highlight your code.
Anyway. No offense, but have you checked if the wii connector is not upside down connected? This can be easily done wrong.

Also, are you using a wireless wii controller or a wired one?


#3

OMG. Thanks Robert. I thought it was a wireless receiver. The directions did not say either way.
After reading your post, I pluged it in and works. dooo.

BTW - I am still getting those GC “dumps” every so often going back to Debug window. Is there a way to turn those off? tia

GC: 2msec 18180 bytes used, 46200 bytes available
Type 0F (STRING ): 168 bytes


#4
Debug.EnableGCMessages( false );

#5

Glad you got it to work! ;D
The connector on the wii expansion should provide plugging in upside down, but in a rush you can still connect it wrong.

Are you using wired or wireless?

Keep us posted with your progress! ;D