==== Code Arduino ==== == Main == #include Servo servothumb; // Define thumb servo Servo servoindex; // Define index servo Servo servomajeure; Servo servoringfinger; Servo servopinky; Servo servowrist; Servo servobiceps; Servo servorotate; Servo servoshoulder; Servo servoomoplat; Servo servoneck; Servo servorothead; int buton0=1; int buton90=2; int butonALL=3; void setup() { servothumb.attach(8); // Set thumb servo to digital pin 2 servoindex.attach(9); // Set index servo to digital pin 3 servomajeure.attach(10); servoringfinger.attach(11); servopinky.attach(12); servowrist.attach(13); //servobiceps.attach(8); //servorotate.attach(9); //servoshoulder.attach(10); //servoomoplat.attach(11); //servoneck.attach(12); //servorothead.attach(13); pinMode(buton0,INPUT); pinMode(buton90,INPUT); pinMode(butonALL,INPUT); } void loop() { // Loop through motion tests //alltovirtual(); // Example: alltovirtual //delay(4000); // Wait 4000 milliseconds (4 seconds) //alltorest(); // Uncomment to use this //delay(4000); // Uncomment to use this //alltomax(); // Uncomment to use this //delay(2000); // Uncomment to use this //allto90(); // Uncomment to use this //delay(2000); // Uncomment to use this //servowrist.write(90); if(digitalRead(buton0)==HIGH){ alltovirtual(); //delay(5000); } else if(digitalRead(buton90)==HIGH){ allto90(); //delay(5000); } else if(digitalRead(butonALL)==HIGH){ alltomax(); //delay(5000); } delay(2000); //servowrist.write(0); } // Motion to set the servo into "virtual" 0 position: alltovirtual void alltovirtual() { servothumb.write(0); servoindex.write(0); servomajeure.write(0); servoringfinger.write(0); servopinky.write(0); servowrist.write(90); /*servobiceps.write(0); servorotate.write(20); //Never less then (20 degree) servoshoulder.write(30); //Never less then (30 degree) servoomoplat.write(10); //Never less then (10 degree) servoneck.write(0); servorothead.write(0);*/ } // Motion to set the servo into "rest" position: alltorest void alltorest() { servothumb.write(0); servoindex.write(0); servomajeure.write(0); servoringfinger.write(0); servopinky.write(0); servowrist.write(0); /* servobiceps.write(0); servorotate.write(90); //Never less then (20 degree) servoshoulder.write(30); //Never less then (30 degree) servoomoplat.write(10); //Never less then (10 degree) servoneck.write(90); servorothead.write(90);*/ } // Motion to set the servo into "max" position: alltomax void alltomax() { servothumb.write(130); servoindex.write(150); servomajeure.write(140); servoringfinger.write(140); servopinky.write(125); servowrist.write(45); /* * servobiceps.write(85); //Never more then (85 or 90degree) servorotate.write(110); //Never more then (110 degree) servoshoulder.write(130); //Never more then (130 degree) servoomoplat.write(70); //Never more then (70 degree) servoneck.write(180); servorothead.write(180); */ } // Motion to set the servo into "90" position: allto90 void allto90() { servothumb.write(80); servoindex.write(90); servomajeure.write(90); servoringfinger.write(85); servopinky.write(90); servowrist.write(50); /* servobiceps.write(90); //Never more then (85 or 90degree) servorotate.write(90); //Never more then (110 degree) servoshoulder.write(90); //Never more then (130 degree) servoomoplat.write(70); //Never more then (70 degree) servoneck.write(90); servorothead.write(180); */ } == Nunchuck == /* * ArduinoNunchukDemo.ino * * Copyright 2011-2013 Gabriel Bianconi, http://www.gabrielbianconi.com/ * * Project URL: http://www.gabrielbianconi.com/projects/arduinonunchuk/ * */ //Bibliothèques #include "Servo.h" #include #include #define BAUDRATE 19200 ArduinoNunchuk nunchuk = ArduinoNunchuk(); int joyX,joyY; //Servo du bas : Servo servoBas; int pinServoBas = 9; int servoBasInit = 90; void setup() { //Initialisation des servos : servoBas.attach(pinServoBas); servoBas.write(servoBasInit); Serial.begin(BAUDRATE); nunchuk.init(); } void loop() { nunchuk.update(); //Joystick Y (nommé joyY) -> Servo bas joyX = nunchuk.analogX, DEC; Serial.println(joyX); joyX = map(joyX, 220, 30, 0, 180); servoBas.write(joyX); Serial.print(joyX); Serial.print(' '); delay(100); } ==== Liens Arduino ==== http://letmeknow.fr/blog/2013/08/22/tuto-nunchuck-et-servo-moteur/ https://prutsers.wordpress.com/2010/07/23/how-to-wire-a-wii-nunchuck-to-your-arduino-mega-without-cutting-the-cord/ http://tiptopboards.free.fr/arduino_forum/viewtopic.php?f=2&t=2 https://create.arduino.cc/projecthub/infusion/using-a-wii-nunchuk-with-arduino-597254 http://www.robot-maker.com/forum/blog/62/entry-57-utiliser-une-nunchuk/ https://www.skitoo.net/tutoriel-arduino-comment-controler-un-servomoteur-avec-un-nunchuck-de-wii/ http://quai-lab.com/utilisation-snap4arduino-en-robotique-educative-animer-main-du-robot-humanoide-inmoov/