Pages: [1]   Go Down
Author Topic: Wii nunchuck with arduino  (Read 237 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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?
Logged

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12177
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You'll need to show us exactly how its connected...
Logged

[ I won't respond to messages, use the forum please ]

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34143
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Pages: [1]   Go Up
Jump to: