Nunchuck Update


You video gameboard presents exciting opportunities, but I have had a lot of frustration with it. Firstly, your files (as downloaded on 11/12/2012) use different capitalization in different places. You file is named nunchuck.cpp and nunchuck.h but the class inside is called Nunchuck, Inside of nunchuckdemo.ino the class name and the variable name are the same accept for the Capital N on the class, and I found this confusing. I named my variable nunChuckLive, and re-factored it through out the file.

I have soldered the kit together, that was fun, It now will connect to my Arduino Uno, and do Serial communication, just fine. I tested a genuine Wii Remote (Red) with tobbot’s code and it works, getting data out of the wiiChuck and back through the serial port.

When I load your nunchuck_demo.ino sketch into your board I can get serial responses back IF I comment out the line: nunchuck.update(); but of course this is the critical line that gets a new batch of sensor reads from the wiiChuck.

I think that the problem is that there is no sensible value for NUNCHUCK_I2C_ADDR in the nunchuck.cpp file. I cannot find anywhere where this constant is declared, or initialized. I am not even sure why it is compiling, unless maybe it is not being checked because it is immediately added to other variables on line 80:

i2cmaster::i2c_start_wait(NUNCHUCK_I2C_ADDR + I2C_WRITE, 10);

and line 96.

I am getting a great education here, and I GUESS that was part of why I bought you board, but on the other hand I did pay money for this product, and I don’t like having to work this hard just to get it to work.


By the way I am using an Acer Windows 7 64 bit laptop, and Arduino IDE 1.0.6.


I do not have a Video Game Shield in front of me right now, so I cannot test on the latest Arduino release at the moment, but we have tested our product on a variety of Wii Nunchucks, legit and “less than legitimate”. It works for us, and I’m pretty sure we’ve sold a few thousand of these at this point. Thank you for your post. I’m sorry it isn’t working for you right away.

I see your point about the naming of objects, but this isn’t really unusual in the Arduino community. Most library names are capitalized, and source files are not.

For example, in one of my open tabs, I have a button library called Button, with the example line of:

Button button = Button(12, PULLUP);

While I can see how it can be confusing for beginners, it’s a delicate tradeoff between following what the rest of the community does and creating something new.

With regards to your constant, NUNCHUCK_I2C_ADDR is defined in nunchuck.h.

#define NUNCHUCK_I2C_ADDR               0xA4

The line that includes nunchuck.h is the second non-comment line in nunchuck_demo.ino:

#include <nunchuck.h>

(It is also in nunchuck.cpp, but do not worry about double-includes–it is protected by the standard ifdef guard.)

Did you have this problem before you started modifying the library?