Yes, I got it from you.
Nunchuck
#include <Wire.h>
#include "nunchuck_funcs.h"
#include <Servo.h>
byte accx,accy,zbut,cbut;
int ledPin = 13;
Servo myservo;
Servo myservo2;
long previousMillis = 0;
void setup()
{
myservo.attach(7);
myservo2.attach(6);
Serial.begin(19200);
nunchuck_setpowerpins();
nunchuck_init(); // send the initilization handshake
Serial.print("WiiChuckDemo ready\n");
}
void loop()
{
if (millis() - previousMillis > 100)
{
previousMillis = millis();
nunchuck_get_data();
accx = nunchuck_accelx(); // ranges from approx 70 - 182
accy = nunchuck_accely(); // ranges from approx 65 - 173
zbut = nunchuck_zbutton();
cbut = nunchuck_cbutton();
myservo.write(map(accx, 70, 182, 0, 180));
myservo2.write(map(accy, 65, 173, 0, 180));
Serial.print("accx: "); Serial.print((byte)accx,DEC);
Serial.print("\taccy: "); Serial.print((byte)accy,DEC);
Serial.print("\tzbut: "); Serial.print((byte)zbut,DEC);
Serial.print("\tcbut: "); Serial.println((byte)cbut,DEC);
}
}