Program:
DownloadArduino:
After some research, I managed to find a program that worked for the type of nunchuk I had, as well as a helpful Google Project entry to go with it. The creator of the program and the entry, Radek Karpowicz, would seem to be a quite skilled programmer and was generous enough to licence his program under the Creative Commons 3.0 BY-SA license. This allows me to edit and redistribute his program, of course, giving him credit for his work. Unfortunately, I am relatively new to arduino programming. As such, my modifications are not ideal, however with some tweaking and patience, they work.
I recommend taking a look at Karpowicz's Google Project entry before continuing.
There is also a blog explaining in more detail a similar program's method of interfacing with a wireless nunchuk located here.
If you have a wireless nunchuk other than Nyko Kama, Datel Wireless Duo-FX or Intec's wireless nunchuk and this program does not work for you, I suggest checking out the arduino forums. You may also wish to read the instructable on the matter (single nunchuk).
Processing:
The processing code uses several different libraries, the first of which is the serial library, the purpose of which is self explanatory. The second is PeasyCam. This library allows the use of the mouse to control the view angle, zoom and pan. The library can be downloaded here. The third library is the Robot library. This library allows for interfacing with the keyboard and mouse controls, allowing one to control the mouse and use the nunchuk buttons as keys. These functions are disabled by default via //comment. Ensure you save all open projects before compiling a program that uses Robot.
The processing program displays the serial data as two vectors and displays the previous 50 vectors connected via lines. The program also allows for each vector's connected lines' colours to be changed via the thumbstick. This is achieved via a set of Arraylists.
Wiring:
The physical setup for a dual wireless nunchuk interface was devised by integrating Karpowicz's design, shown on his Google Project entry with a switching concept observed here, created by Johnnyonthespot.
As mentioned by Karpowicz, the SDA and SDL pins must be connected to 1.8k pullup resistors.
The interface schematic between the arduino and the nunchuk's wireless module can be seen below:
Note: this interface using the I2C pins, SDA (data) and SDL (clock), of the arduino, these allow for sending and receiving using set protocols via the "wire.h" library. On my board SDA is located on pin 20, and SCL on 21, on other boards these pin locations may be changed or nonexistent.
In this example, I used pins 6 and 7 to control the switching between the two nunchuk wireless modules instead of 22 and 24, this can easily be changed in the arduino program by changing the values for nunchuk1 and nunchuk2 to the desired pin numbers.
The transistors I used were 2N2222 and the resistors connected to the Base of each transistor have a value of 680 ohms.
Connecting Nunchuks to Arduino:
To connect the nunchuks to the arduino a bit of patience is needed. You must first power up both nunchuks, then press the sync button for one of them (for example; the one in your right hand). Once the serial output displays "Waiting for Duo FX Controller Device" again then you must then sync the second nunchuk. The program will then try to connect to the second nunchuk. This may take some time, as the setups for each of the nunchuks tend to interfere with each other. If, after a minute or two, the setup does not complete, try turning one of the nunchuks off, closing the display window, recompile ►, then turning the nunchuk on and resynchronizing it. After the first successful setup, the setup often goes much quicker for the setups thereafter when recompiling.