Jump to content


Posted by k-Pack, 11 December 2014 · 1,526 views

Wii Classic Arduino Joystick
Since I was successful getting the Wii Nunchuk hooked up to the Joystick port I thought I would try the Wii Classic Controller (WCC). The hardware was simple, unplug the nunchuk attached to the Arduino project from my last blog and plug in the WCC. It was my poor choice of internet search criterial that gave me the most trouble.
Attached Image
I just needed to find the function library for the WCC. The first search pointed me to “playground.arduino.cc/Main/WiiClassicController”.  This is a library created by Tim Hizel in May of 2008.  The library and example program worked as stated but only reported the buttons once or twice and then reset, even if the button was still pressed. 
I needed to be able to read the logic state while the button was pressed. Sooooo, it was back to the search engine.  After a couple of days of half-hearted searching I decided that I would need to figure out why the button state reset and write my own library.
But that night there was a Christmas Miracle. I found myself wide awake at 4:00AM. Mostly due to the excitement from the anticipation of Santa’s arrival. After all, only 14 days till Christmas.
Anyway, I decided not to fight it and sat on the couch searching for the elusive library. I clicked on a search link and in a flash I was at “playground.arduino.cc/Main/WiiClassicController10” (see the difference?).  This library is an exact replacement for Tim’s; written by Robbert Brandsman in 2012. It keeps the state of the buttons while they are pressed.  Just what I needed.
Now load the following sketch. Change the #include to point to the WiiClassicController10 library you downloaded.  Upload it to the Arduino and you are ready to play any game that requires the joystick.
The sketch uses the DPad for the direction control and the X or Y button for the trigger.  I suppose if you got this far, you can modify the program to reflect your preferences.
void setup(){

void loop() {
  delay(10); // 1ms is enough to not overload the wii Classic, 100ms seems to ease the serial terminal a little
  if (wiiClassy.upDPressed()) {digitalWrite(Up_Pin,HIGH);
  else {digitalWrite(Up_Pin,LOW);}
  if (wiiClassy.downDPressed()) {digitalWrite(Down_Pin,HIGH);
  else {digitalWrite(Down_Pin,LOW);
  if (wiiClassy.leftDPressed()) {digitalWrite(Left_Pin,HIGH);
  else {digitalWrite(Left_Pin,LOW);
  if (wiiClassy.rightDPressed()) {digitalWrite(Right_Pin,HIGH);
  else {digitalWrite(Right_Pin,LOW);
  if(wiiClassy.xPressed() || wiiClassy.yPressed()) {
  else {digitalWrite(Trig_Pin,LOW);
I’ve been using the Atari Joystick for so long that while playing Missile Command with the WCC I noticed my left thumb was taping the DPad, as if it was a big red button. A reboot ain’t guna correct that problem.

Latest Visitors