Instructables

Wii Nunchuck Adapter

FeaturedContest Winner

Step 9: Testing The adapter

1020091709.jpg
1020091710.jpg
If you dont have the Arduino program installed yet then go to www.arduino.cc/en/Guide/HomePage and follow the arduino getting started tutorial.
Part I
1) DOWNLOAD these 2 files
www.megaupload.com/
www.megaupload.com/
2) Create a new folder called "WiiChuckDemo" without the quotes.
3) Place those 2 files in the folder
4) Open up arduino IDE and goto file> open> and open "WiichuckDemo.pde"
5) Upload that sketch to your arduino
6) we are done with part 1

Part II
+various jumper wires
+4 leds
+the nunchuck adapter
+bread board or protoshield
+and a wii nunchuck
1) Plug in the adapter into analog pins 5,4,3, and 2 like image 1 shows.
2) Now were are going to put in all our ground jumpers, in a "daisy chain" style. (image 2)
3) Now put in all the wire going from the LED's positive legs to there coresponding pins on the arduino. (image 3)
UP led= digital pin 4
DOWN led= digital pin 5
LEFT led= digital pin 2
RIGHT led= digital pin 3
4) Now its time to place our leds into the bread board making sure that the short leg or the flat side on the led is in the ground, and the long leg is in the positive (or the wire going to the arduino digital pins) (image 4)
5) plug in you wii nunchuck
6) power up your arduino
7) and hopfully it will work if now leave a comment and i will try my best to help you.
8) heres a demo video





 
Remove these adsRemove these ads by Signing Up
jrast3622 years ago
i think that the whole idea behind this could be very useful but now that megaupload is down i cant get the two files. Is there any way i can get them?
redsunmtm2 years ago
hi,
excuse me but i am really a newbee in arduino...
i am trying to make this instructable, but when i want to load the sketch i have this error:
-------------------------------------------------------------------------------------------------------------------
In file included from WiiChuckDemo.cpp:2:
/nunchuck_funcs.h:13:22: error: WProgram.h: No such file or directory
In file included from WiiChuckDemo.cpp:2:
/nunchuck_funcs.h: In function 'void nunchuck_setpowerpins()':
nunchuck_funcs.h:24: error: 'delay' was not declared in this scope
/nunchuck_funcs.h: In function 'void nunchuck_init()':
nunchuck_funcs.h:33: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

nunchuck_funcs.h:34: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

/nunchuck_funcs.h: In function 'void nunchuck_send_request()':
nunchuck_funcs.h:43: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

/nunchuck_funcs.h: In function 'int nunchuck_get_data()':
nunchuck_funcs.h:63: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

/nunchuck_funcs.h: In function 'void nunchuck_print_data()':
nunchuck_funcs.h:114: error: 'Serial' was not declared in this scope

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
i also tested various sketches from other instructables and i always have errors !
with the included libraries i have no problem !!!
what is it happening ?
please help me !
PS:
i have the Arduino Mega Atmega1280 and use Arduino V1.0
dany32412 (author)  redsunmtm2 years ago
Sorry i didnt reply earlier. Yeah i hate that new arduino 1.0, there's too many changes. All my libaries from before don't work on it. I'm just using Arduino 22 until they male some changes. See if it works with that
hello and happy new year
thanks for answering that quick !
so it is due to the V1 ?!?
i was searching the Arduino 22, but i cant find it ! could you please send me that version by mail please?
tha would be very friendly...
regards
it is ok i found at arduino's, i was searching in google arduino 22 and couldn't find nothing, but went to site and voila, thank you, i am going to get 0022 and 0023 to see, thanks again.
dany32412 (author)  redsunmtm2 years ago
Im glad you found everything. Version 22 and 23 should work, but i'm currently working on getting the library to work with Arduino V1. Hopefully ill post that soon
hy,
yes i found them, but nothing works, i mean, the sketches seem to install correctly, but nothing happens, only sometimes the led 13 keeping alive and my up and left led staying lighting with no change from nunchuck.
the leds are new, the nunchuk too and even better i cutted the cable to connect directly on the board, so no false contact... but nothing...
have tryed to send only the pde, then i try to send pde and h files and nothing... disapointed ! :(
i think i'll wait you V1 version !
thanks
redsunmtm2 years ago
hy again,
now i placed the folder in C:\Documents and Settings\mich\My documents\Arduino\
i open the .ino i converted before, start loading and now:
----------------------------------------------------------------------------------------------------------------------
In file included from WiiChuckDemo.cpp:2:
/nunchuck_funcs.h:13:22: error: WProgram.h: No such file or directory
In file included from WiiChuckDemo.cpp:2:
/nunchuck_funcs.h: In function 'void nunchuck_setpowerpins()':
nunchuck_funcs.h:24: error: 'delay' was not declared in this scope
/nunchuck_funcs.h: In function 'void nunchuck_init()':
nunchuck_funcs.h:33: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

nunchuck_funcs.h:34: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

/nunchuck_funcs.h: In function 'void nunchuck_send_request()':
nunchuck_funcs.h:43: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

/nunchuck_funcs.h: In function 'int nunchuck_get_data()':
nunchuck_funcs.h:63: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

/nunchuck_funcs.h: In function 'void nunchuck_print_data()':
nunchuck_funcs.h:114: error: 'Serial' was not declared in this scope
In file included from WiiChuckDemo.cpp:105:
/nunchuck_funcs.h: At global scope:
nunchuck_funcs.h:14: error: redefinition of 'uint8_t nunchuck_buf [6]'
nunchuck_funcs.h:14: error: 'uint8_t nunchuck_buf [6]' previously declared here
/nunchuck_funcs.h: In function 'void nunchuck_setpowerpins()':
nunchuck_funcs.h:17: error: redefinition of 'void nunchuck_setpowerpins()'
nunchuck_funcs.h:17: error: 'void nunchuck_setpowerpins()' previously defined here
/nunchuck_funcs.h: In function 'void nunchuck_init()':
nunchuck_funcs.h:29: error: redefinition of 'void nunchuck_init()'
nunchuck_funcs.h:29: error: 'void nunchuck_init()' previously defined here
nunchuck_funcs.h:33: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

nunchuck_funcs.h:34: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

/nunchuck_funcs.h: In function 'void nunchuck_send_request()':
nunchuck_funcs.h:40: error: redefinition of 'void nunchuck_send_request()'
nunchuck_funcs.h:40: error: 'void nunchuck_send_request()' previously defined here
nunchuck_funcs.h:43: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

/nunchuck_funcs.h: In function 'char nunchuk_decode_byte(char)':
nunchuck_funcs.h:49: error: redefinition of 'char nunchuk_decode_byte(char)'
nunchuck_funcs.h:49: error: 'char nunchuk_decode_byte(char)' previously defined here
/nunchuck_funcs.h: In function 'int nunchuck_get_data()':
nunchuck_funcs.h:57: error: redefinition of 'int nunchuck_get_data()'
nunchuck_funcs.h:57: error: 'int nunchuck_get_data()' previously defined here
nunchuck_funcs.h:63: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

/nunchuck_funcs.h: In function 'void nunchuck_print_data()':
nunchuck_funcs.h:79: error: redefinition of 'void nunchuck_print_data()'
nunchuck_funcs.h:79: error: 'void nunchuck_print_data()' previously defined here
/nunchuck_funcs.h: In function 'int nunchuck_zbutton()':
nunchuck_funcs.h:141: error: redefinition of 'int nunchuck_zbutton()'
nunchuck_funcs.h:141: error: 'int nunchuck_zbutton()' previously defined here
/nunchuck_funcs.h: In function 'int nunchuck_cbutton()':
nunchuck_funcs.h:147: error: redefinition of 'int nunchuck_cbutton()'
nunchuck_funcs.h:147: error: 'int nunchuck_cbutton()' previously defined here
/nunchuck_funcs.h: In function 'int nunchuck_joyx()':
nunchuck_funcs.h:153: error: redefinition of 'int nunchuck_joyx()'
nunchuck_funcs.h:153: error: 'int nunchuck_joyx()' previously defined here
/nunchuck_funcs.h: In function 'int nunchuck_joyy()':
nunchuck_funcs.h:159: error: redefinition of 'int nunchuck_joyy()'
nunchuck_funcs.h:159: error: 'int nunchuck_joyy()' previously defined here
/nunchuck_funcs.h: In function 'int nunchuck_accelx()':
nunchuck_funcs.h:165: error: redefinition of 'int nunchuck_accelx()'
nunchuck_funcs.h:165: error: 'int nunchuck_accelx()' previously defined here
/nunchuck_funcs.h: In function 'int nunchuck_accely()':
nunchuck_funcs.h:171: error: redefinition of 'int nunchuck_accely()'
nunchuck_funcs.h:171: error: 'int nunchuck_accely()' previously defined here
/nunchuck_funcs.h: In function 'int nunchuck_accelz()':
nunchuck_funcs.h:177: error: redefinition of 'int nunchuck_accelz()'
nunchuck_funcs.h:177: error: 'int nunchuck_accelz()' previously defined here
WiiChuckDemo.cpp: At global scope:
WiichuckDemo:3: error: redefinition of 'int loop_cnt'
WiichuckDemo.pde:-1: error: 'int loop_cnt' previously defined here
WiichuckDemo:5: error: redefinition of 'byte accx'
WiichuckDemo.pde:-1: error: 'byte accx' previously declared here
WiichuckDemo:5: error: redefinition of 'byte accy'
WiichuckDemo.pde:-1: error: 'byte accy' previously declared here
WiichuckDemo:5: error: redefinition of 'byte accz'
WiichuckDemo.pde:-1: error: 'byte accz' previously declared here
WiichuckDemo:5: error: redefinition of 'byte joyx'
WiichuckDemo.pde:-1: error: 'byte joyx' previously declared here
WiichuckDemo:5: error: redefinition of 'byte joyy'
WiichuckDemo.pde:-1: error: 'byte joyy' previously declared here
WiichuckDemo:5: error: redefinition of 'byte zbut'
WiichuckDemo.pde:-1: error: 'byte zbut' previously declared here
WiichuckDemo:5: error: redefinition of 'byte cbut'
WiichuckDemo.pde:-1: error: 'byte cbut' previously declared here
WiichuckDemo:6: error: redefinition of 'int ledPin'
WiichuckDemo.pde:-1: error: 'int ledPin' previously defined here
WiichuckDemo:7: error: redefinition of 'int Lledpin'
WiichuckDemo.pde:-1: error: 'int Lledpin' previously defined here
WiichuckDemo:8: error: redefinition of 'int Rledpin'
WiichuckDemo.pde:-1: error: 'int Rledpin' previously defined here
WiichuckDemo:9: error: redefinition of 'int Uledpin'
WiichuckDemo.pde:-1: error: 'int Uledpin' previously defined here
WiichuckDemo:10: error: redefinition of 'int Dledpin'
WiichuckDemo.pde:-1: error: 'int Dledpin' previously defined here
WiiChuckDemo.cpp: In function 'void setup()':
WiichuckDemo:13: error: redefinition of 'void setup()'
WiichuckDemo.pde:-1: error: 'void setup()' previously defined here
WiiChuckDemo.cpp: In function 'void loop()':
WiichuckDemo:22: error: redefinition of 'void loop()'
WiichuckDemo.pde:-1: error: 'void loop()' previously defined here
----------------------------------------------------------------------------------------------------------------------
another type of error... i don't understand...
redsunmtm2 years ago
hello again,
i placed the .pde and the .h files to: libraries\Servo\examples\WiiChuckDemo
then i renamed .pde to .ino
i restart loading and now here is the error:
----------------------------------------------------------------------------------------------------------------------
sketch_jan01a.cpp:3:28: error: nunchuck_funcs.h: No such file or directory
sketch_jan01a.cpp: In function 'void setup()':
WiichuckDemo:16: error: 'nunchuck_setpowerpins' was not declared in this scope
WiichuckDemo:17: error: 'nunchuck_init' was not declared in this scope
sketch_jan01a.cpp: In function 'void loop()':
WiichuckDemo:27: error: 'nunchuck_get_data' was not declared in this scope
WiichuckDemo:29: error: 'nunchuck_accelx' was not declared in this scope
WiichuckDemo:30: error: 'nunchuck_accely' was not declared in this scope
WiichuckDemo:31: error: 'nunchuck_accelz' was not declared in this scope
WiichuckDemo:32: error: 'nunchuck_joyx' was not declared in this scope
WiichuckDemo:33: error: 'nunchuck_joyy' was not declared in this scope
WiichuckDemo:34: error: 'nunchuck_zbutton' was not declared in this scope
WiichuckDemo:35: error: 'nunchuck_cbutton' was not declared in this scope
-------------------------------------------------------------------------------------------------------------------
it looks like no finding the.h file ...
what i am doing wrong ?
please help !
thank you in advance.
Excuse me for being ignorant, but what exactly is the point of this?
keler4 years ago
Thank you!
(your sense of humor highly appreciated :)
windrago4 years ago
 super!
and I loved the comments on the pixes :-))