Go Down

Topic: Wii nunchuck with arduino (Read 281 times) previous topic - next topic

ldar2020

Hello, I have a Wii nunchuck that I am trying to connect with m arduino. I have been to many sites for simple testing but all have failed. This is the example code in the "ArduinoNunchuck" library:
Code: [Select]
#include <Wire.h>
#include <ArduinoNunchuk.h>

#define BAUDRATE 19200

ArduinoNunchuk nunchuk = ArduinoNunchuk();

void setup()
{
  Serial.begin(BAUDRATE);
  nunchuk.init();
}

void loop()
{
  nunchuk.update();
 
  Serial.print(nunchuk.analogX, DEC);
  Serial.print(' ');
  Serial.print(nunchuk.analogY, DEC);
  Serial.print(' ');
  Serial.print(nunchuk.accelX, DEC);
  Serial.print(' ');
  Serial.print(nunchuk.accelY, DEC);
  Serial.print(' ');
  Serial.print(nunchuk.accelZ, DEC);
  Serial.print(' ');
  Serial.print(nunchuk.zButton, DEC);
  Serial.print(' ');
  Serial.println(nunchuk.cButton, DEC);
}


When I have everything connected and upload the sketch and open the serial monitor, it is blank. When i disconnect the nunchuck and open the serial monitor, the serial monitor starts scrolling the values. If I plug in the nunchuck it freezes. How can I fix this?

MarkT

You'll need to show us exactly how its connected...
[ I won't respond to messages, use the forum please ]

Grumpy_Mike

For best results you need to power it from 3V3, have external pull up resistors  to this voltage and disable the internal pull ups that go to 5V

ldar2020

Well I have the ground lead going into the ground on the arduino, the 3v3 lead going into the 3.3v of the arduino, the SDA lead going into Analog(4) pin and the SCL lead going into Analog(5) of the arduino. And I shouldn't have to deal with pull up resistors because there are several demonstrations of working projects but I will try...

Go Up