I've tried adding an init handshake to the sketch's setup routine, but still no luck:
void
setup ()
{
Wire.begin (0x52); // join i2c bus with address 0x52
// this is the nunchuk address.
// all nunchuks use this address
outbuf[0] = 0xa4;
outbuf[1] = 0x40;
outbuf[2] = 0x00;
Wire.send (outbuf, 3);
I got Frank Zhao's Wiimote Extension Library from here:
and ported it over to the Arduino this afternoon.
My sketch is working with Frank's library, appears to be handshaking with the Wiimote correctly, then transmitting consistently to the Wiimote, which in turn reports to the PC .... the issue to solve appears to be the Arduino/Nunchuck ID.
There are several different web sites and Wiimote libraries available ..... and each one documents or expects something slightly different! It doesn't seem to matter what ID I use, it's always garbled by the time it prints to a console on the PC side. For example, using the Guitar Extension ID
0x00 0x00 0xA4 0x20 0x01 0x03
wiiuse decrypts and reports the extension ID
0xa4200103
Using the Wiimote Extension Library, I have successfully had the Arduino masquarding as a Guitar Hero 3 controller!!!! Only took 3 days from cutting the Nunchuk cord to seeing "Guitar Hero 3 extension attached" on the console.
Next week I'll be building a custom controller and writting this up for the Playground.
westfw:
Not sure what was going on with the leading zeros, or why they were being suppressed, but that was an example of what I meant by "garbled." With a few tweaks to library to make sure encrypted bytes are sent to the wiimote, it all works, so I'm assuming the dropped zeros were related to encryption/decrytion on the PC driver side.