nunchuk-arduino.ino:`#include <Wire.h>
#include "nunchuk.h"
void setup() {
Serial.begin(115200);
Wire.begin();
// nunchuk_init_power(); // A1 and A2 is power supply
nunchuk_init();
}
void loop() {
if (nunchuk_read()) {
// Work with nunchuk_data
char buf[100];
sprintf(buf, "Speed=%4d Steer=%4d\n",
nunchuk_joystickY()*512, nunchuk_joystickX()*512);
Serial.print(buf);
}
delay(100);
}
`
nunchuk.h neben nunchuk-arduino.ino ablegen