Robotic arm using Servo's & Wii Nunchuck

Hello guys, im extremely new to Arduino and i need to make a robotic arm with a wii nunchuck that controls 6 servo’s for my school project.

But i cant get my nunchuck to work with the servo’s. I can read out the data but even some “working” codes from other peoples projects dont seem to work either.

i tried being a smartass and using the servo Knob code but it doesn’t work like this unsurprisingly

Here’s the code:

Any help is apreciated, thanks in advance :slight_smile:

#include <Wire.h>
#include <ArduinoNunchuk.h>

#define BAUDRATE 19200

ArduinoNunchuk nunchuk = ArduinoNunchuk();

// SCL is connected to A5
// SDA is connected to A4
// +3.3V connected to +
// GND connected to -

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

void loop()
{
  nunchuk.update();

  Serial.print("X: ");
  Serial.print(nunchuk.analogX, DEC);
  Serial.print(' ');
  Serial.print("Y: ");  
  Serial.print(nunchuk.analogY, DEC);
  Serial.print(' ');
  Serial.print("Acc X: ");
  Serial.print(nunchuk.accelX, DEC);
  Serial.print(' ');
  Serial.print("Acc Y: ");
  Serial.print(nunchuk.accelY, DEC);
  Serial.print(' ');
  Serial.print("Acc Z: ");
  Serial.print(nunchuk.accelZ, DEC);
  Serial.print(' ');
  Serial.print("Z btn: ");
  Serial.print(nunchuk.zButton, DEC);
  Serial.print(' ');
  Serial.print("C btn: ");
  Serial.println(nunchuk.cButton, DEC);
}

So what does it do? And what do you expect it to do? It certainly isn't trying to drive 6 servos.

First thing, do your serial prints show sensible values for what you should be reading from the nunchuck? Post an example.

Steve

I'm getting numbers on my serial port from all the sensors. But I have no clue how I can use those numbers to control servo's

Getting these readings and they change when I use the nunchuck.

X: 126 Y: 133
Accelerometer X Y Z
Button C 0
Button Z 0

And all tutorials are either with library links that don't work or they're in foreign language which I don't understand

Take small steps.
You say the readings change when you use the nunchuck.
Take one, say X. What range covers the readings? Play with the nunchuck and see what you have to do to get the lowest and highest values for X. Note those values so you have a defined range.
Then you can map that range in to a servo command. Just like the knob tutorial does.