Submitted by Edward (not verified) on Thu, 2007-11-22 09:36.
So I just finished getting this hack working on a PIC24F. Thanks a lot chad and everyone else for sharing your knowledge!
For a while I was having the same problem others have reported here with the nunchuck always replying with 0xFF. The solution was a ~20ms delay prior to sending the initialization request (0x40, 0x00), and then a ~1 ms delay between sending the request byte (0x00) and reading the data was required. Those times may be high, as I haven't spent much time trying to find the true minimums. The Arduino code probably runs slow enough between those routines that it fulfills the timing requirements w/o extra delay.
Anyways, I wanted to share that, in case it helps someone avoid hours of needless debuggin. Also, I will post my sample code later today or tomorrow in case anyone is interested.
Required Delays
So I just finished getting this hack working on a PIC24F. Thanks a lot chad and everyone else for sharing your knowledge!
For a while I was having the same problem others have reported here with the nunchuck always replying with 0xFF. The solution was a ~20ms delay prior to sending the initialization request (0x40, 0x00), and then a ~1 ms delay between sending the request byte (0x00) and reading the data was required. Those times may be high, as I haven't spent much time trying to find the true minimums. The Arduino code probably runs slow enough between those routines that it fulfills the timing requirements w/o extra delay.
Anyways, I wanted to share that, in case it helps someone avoid hours of needless debuggin. Also, I will post my sample code later today or tomorrow in case anyone is interested.