Compilation error: servo.h: No such file or directory

bonjour,
je débute en programmation
j ai un probleme et je sais pas ce que ca veut dire
merci de votre aide

C:\Users\user\OneDrive\Documents\Arduino\Arduino_Otto_Robot\Arduino_Otto_Robot.ino:1:10: fatal error: servo.h: No such file or directory
#include <servo.h>
^~~~~~~~~
compilation terminated.

exit status 1

Compilation error: servo.h: No such file or directory

tu as peut etre oublié d'incorporer la bibliothèque SERVO.H que tu appelles dans ton code.

Il faut l'ajouter à ton sketch, après avoir vérifié que la bibliothèque était bien dispo sur ton ordinateur.

Dans Arduino IDE: Sketch -> Include Library -> cherche SERVO.H

et tiens nous au courant si ça règle ton problème! :+1:

EDIT: toutes tes libraries disponibles pour tes sketchs (celles téléchargées, et celles que tu créés toi même) sont stockés dans Arduino/Libraries. Jette y un coup d'oeil!

merci sympa pour l aide
j ai ca comme code

#include <servo.h>

#include <servo.h> //-- Otto Library version 9
servo;  //This is Otto!
//---------------------------------------------------------
// Face should be in front of you
/*
                 --------------- 
                |     O   O     |
                |---------------|
Left leg =>     |               |    <= Right leg
                 --------------- 
                    ||     ||
Left foot =>     -----   ------     <= Right foot
                 |-----   ------|
*/
// SERVO PINs //////////////////////////////////////////////////////////////////////////////
#define PIN_YL 8 //servo[0]  left leg
#define PIN_YR 9 //servo[1]  right leg
#define PIN_RL 10 //servo[2]  left foot
#define PIN_RR 11 //servo[3]  right foot
// ULTRASONIC PINs /////////////////////////////////////////////////////////////////////////
#define PIN_Trigger  2  //TRIGGER pin (2)
#define PIN_Echo     3  //ECHO pin (3)
// BUZZER PIN //////////////////////////////////////////////////////////////////////////////
#define PIN_Buzzer  13 //BUZZER pin (13)
// SERVO ASSEMBLY PIN   /////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//-- Global Variables -------------------------------------------//
///////////////////////////////////////////////////////////////////
int distance; // variable to store distance read from ultrasonic range finder module
bool obstacleDetected = false; // logic state for when object detected is at the distance we set
bool obstacleFlag = true; 
//-- Movement parameters
int T=1000;              //Initial duration of movement
int moveId=0;            //Number of movement
int moveSize=15;         //Asociated with the height of some movements
int move = 0;
///////////////////////////////////////////////////////////////////
//-- Setup ------------------------------------------------------//
///////////////////////////////////////////////////////////////////
void setup() {
  Serial.begin(19200);
  Otto.init(PIN_YL, PIN_YR, PIN_RL, PIN_RR, true, A6, PIN_Buzzer, PIN_Trigger, PIN_Echo); //Set the servo pins and ultrasonic pins and Buzzer pin
  //Otto wake up!
  Otto.sing(S_connection);// Otto makes a sound
  Otto.home(); // Otto moves to its ready position
  delay(500); // wait for 500 milliseconds to allow Otto to stop
}

void loop() {
 obstacleDetector();
 
 if(obstacleDetected == true && obstacleFlag ==  true){
   Otto.playGesture(OttoConfused);
  obstacleFlag =  false;
 }

 if(obstacleDetected == false && obstacleFlag ==  false){
  move = random(1,27);
  obstacleFlag =  true;
 }
 
 switch(move){
    case 1:
    Otto.walk(2,1000,1);
    Otto.home();
    move = 0;
    break;
    case 2:
    Otto.walk(2,1000,-1);
    Otto.home();
    move = 0;
    break;
    case 3:
    Otto.turn(2,1000,1);
    Otto.home();
    move = 0;
    break;
    case 4:
    Otto.turn(2,1000,-1);
    Otto.home();
    move = 0;
    break;
    case 5:
    Otto.bend (2,500,1);
    Otto.home();
    move = 0;
    break;
    case 6:
    Otto.bend (2,2000,-1);
    Otto.home();
    move = 0;
    break;
    case 7:
    Otto.shakeLeg (2,1500, 1);
    Otto.home();
    move = 0;
    break;
    case 8:
    Otto.moonwalker(3, 1000, 25,1);
    Otto.home();
    move = 0;
    break;
    case 9:
    Otto.moonwalker(3, 1000, 25,-1);
    Otto.home();
    move = 0;
    break;
    case 10:
    Otto.crusaito(2, 1000, 20,1);
    Otto.home();
    move = 0;
    break;
    case 11:
    Otto.crusaito(2, 1000, 20,-1);
    Otto.home();
    move = 0;
    break;
    case 12:
    Otto.flapping(2, 1000, 20,1);
    Otto.home();
    move = 0;
    break;
    case 13:
    Otto.flapping(2, 1000, 20,-1);
    Otto.home();
    move = 0;
    break;
    case 14:
    Otto.swing(2, 1000, 20);
    Otto.home();
    move = 0;
    break;
    case 15:
     Otto.tiptoeSwing(2, 1000, 20);
    Otto.home();
    move = 0;
    break;
    case 16:
    Otto.jitter(2, 1000, 20); //(small T)
    Otto.home();
    move = 0;
    break;
    case 17:
    Otto.updown(2, 1500, 20);  // 20 = H "HEIGHT of movement"T 
    Otto.home();
    move = 0;
    break;
    case 18:
    Otto.ascendingTurn(2, 1000, 50);
    Otto.home();
    move = 0;
    break;
    case 19:
    Otto.jump(1,500); // It doesn't really jumpl ;P
    Otto.home();
    move = 0;
    break;
    case 20:
    Otto.playGesture(OttoSuperHappy);
    Otto.home();
    move = 0;
    break;
    case 21:
    Otto.playGesture(OttoSad);
    Otto.home();
    move = 0;
    break;
    case 22:
    Otto.playGesture(OttoVictory); 
    Otto.home();
    move = 0;
    break;
    case 23:
    Otto.playGesture(OttoAngry);
    Otto.home();
    move = 0;
    break;
    case 24:
    Otto.playGesture(OttoSleeping);
    Otto.home();
    move = 0;
    break;
    case 25:
    Otto.playGesture(OttoLove);
    Otto.home();
    move = 0;
    break;
    case 26:
    Otto.playGesture(OttoFart);
    Otto.home();
    move = 0;
    break;
    case 27:
    Otto.playGesture(OttoFail);
    Otto.home();
    move = 0;
    break;
 
 }


}

void obstacleDetector() {
  int distance = Otto.getDistance(); // get the distance from the ultrasonic range finder
  if (distance < 15) obstacleDetected = true; // check to see if this distance is closer than 15cm, true if it is
  else obstacleDetected = false;// false if it is not
   Serial.print(distance);
  Serial.println("cm");
 if(distance<15){
          obstacleDetected = true;
          Serial.println ("Obstacle Detected! Avoid collision");
        }else{
          obstacleDetected = false;
          Serial.println ("No Obstacle detected! - Keep on walking");
        }
}

et servo.h j ai ca
#include <servo.h>

#include <servo.h> //-- Otto Library version 9
servo;  //This is Otto!
//---------------------------------------------------------
// Face should be in front of you
/*
                 --------------- 
                |     O   O     |
                |---------------|
Left leg =>     |               |    <= Right leg
                 --------------- 
                    ||     ||
Left foot =>     -----   ------     <= Right foot
                 |-----   ------|
*/
// SERVO PINs //////////////////////////////////////////////////////////////////////////////
#define PIN_YL 8 //servo[0]  left leg
#define PIN_YR 9 //servo[1]  right leg
#define PIN_RL 10 //servo[2]  left foot
#define PIN_RR 11 //servo[3]  right foot
// ULTRASONIC PINs /////////////////////////////////////////////////////////////////////////
#define PIN_Trigger  2  //TRIGGER pin (2)
#define PIN_Echo     3  //ECHO pin (3)
// BUZZER PIN //////////////////////////////////////////////////////////////////////////////
#define PIN_Buzzer  13 //BUZZER pin (13)
// SERVO ASSEMBLY PIN   /////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//-- Global Variables -------------------------------------------//
///////////////////////////////////////////////////////////////////
int distance; // variable to store distance read from ultrasonic range finder module
bool obstacleDetected = false; // logic state for when object detected is at the distance we set
bool obstacleFlag = true; 
//-- Movement parameters
int T=1000;              //Initial duration of movement
int moveId=0;            //Number of movement
int moveSize=15;         //Asociated with the height of some movements
int move = 0;
///////////////////////////////////////////////////////////////////
//-- Setup ------------------------------------------------------//
///////////////////////////////////////////////////////////////////
void setup() {
  Serial.begin(19200);
  Otto.init(PIN_YL, PIN_YR, PIN_RL, PIN_RR, true, A6, PIN_Buzzer, PIN_Trigger, PIN_Echo); //Set the servo pins and ultrasonic pins and Buzzer pin
  //Otto wake up!
  Otto.sing(S_connection);// Otto makes a sound
  Otto.home(); // Otto moves to its ready position
  delay(500); // wait for 500 milliseconds to allow Otto to stop
}

void loop() {
 obstacleDetector();
 
 if(obstacleDetected == true && obstacleFlag ==  true){
   Otto.playGesture(OttoConfused);
  obstacleFlag =  false;
 }

 if(obstacleDetected == false && obstacleFlag ==  false){
  move = random(1,27);
  obstacleFlag =  true;
 }
 
 switch(move){
    case 1:
    Otto.walk(2,1000,1);
    Otto.home();
    move = 0;
    break;
    case 2:
    Otto.walk(2,1000,-1);
    Otto.home();
    move = 0;
    break;
    case 3:
    Otto.turn(2,1000,1);
    Otto.home();
    move = 0;
    break;
    case 4:
    Otto.turn(2,1000,-1);
    Otto.home();
    move = 0;
    break;
    case 5:
    Otto.bend (2,500,1);
    Otto.home();
    move = 0;
    break;
    case 6:
    Otto.bend (2,2000,-1);
    Otto.home();
    move = 0;
    break;
    case 7:
    Otto.shakeLeg (2,1500, 1);
    Otto.home();
    move = 0;
    break;
    case 8:
    Otto.moonwalker(3, 1000, 25,1);
    Otto.home();
    move = 0;
    break;
    case 9:
    Otto.moonwalker(3, 1000, 25,-1);
    Otto.home();
    move = 0;
    break;
    case 10:
    Otto.crusaito(2, 1000, 20,1);
    Otto.home();
    move = 0;
    break;
    case 11:
    Otto.crusaito(2, 1000, 20,-1);
    Otto.home();
    move = 0;
    break;
    case 12:
    Otto.flapping(2, 1000, 20,1);
    Otto.home();
    move = 0;
    break;
    case 13:
    Otto.flapping(2, 1000, 20,-1);
    Otto.home();
    move = 0;
    break;
    case 14:
    Otto.swing(2, 1000, 20);
    Otto.home();
    move = 0;
    break;
    case 15:
     Otto.tiptoeSwing(2, 1000, 20);
    Otto.home();
    move = 0;
    break;
    case 16:
    Otto.jitter(2, 1000, 20); //(small T)
    Otto.home();
    move = 0;
    break;
    case 17:
    Otto.updown(2, 1500, 20);  // 20 = H "HEIGHT of movement"T 
    Otto.home();
    move = 0;
    break;
    case 18:
    Otto.ascendingTurn(2, 1000, 50);
    Otto.home();
    move = 0;
    break;
    case 19:
    Otto.jump(1,500); // It doesn't really jumpl ;P
    Otto.home();
    move = 0;
    break;
    case 20:
    Otto.playGesture(OttoSuperHappy);
    Otto.home();
    move = 0;
    break;
    case 21:
    Otto.playGesture(OttoSad);
    Otto.home();
    move = 0;
    break;
    case 22:
    Otto.playGesture(OttoVictory); 
    Otto.home();
    move = 0;
    break;
    case 23:
    Otto.playGesture(OttoAngry);
    Otto.home();
    move = 0;
    break;
    case 24:
    Otto.playGesture(OttoSleeping);
    Otto.home();
    move = 0;
    break;
    case 25:
    Otto.playGesture(OttoLove);
    Otto.home();
    move = 0;
    break;
    case 26:
    Otto.playGesture(OttoFart);
    Otto.home();
    move = 0;
    break;
    case 27:
    Otto.playGesture(OttoFail);
    Otto.home();
    move = 0;
    break;
 
 }


}

void obstacleDetector() {
  int distance = Otto.getDistance(); // get the distance from the ultrasonic range finder
  if (distance < 15) obstacleDetected = true; // check to see if this distance is closer than 15cm, true if it is
  else obstacleDetected = false;// false if it is not
   Serial.print(distance);
  Serial.println("cm");
 if(distance<15){
          obstacleDetected = true;
          Serial.println ("Obstacle Detected! Avoid collision");
        }else{
          obstacleDetected = false;
          Serial.println ("No Obstacle detected! - Keep on walking");
        }
}

je l ai mis dans la libraire mes doc de arduino sur le pc mais ca marche pas
j ai du mal faire quelque chose
j ai trouver le sketch tout pret

encore merci pour l aide

Si le compilateur signale servo.h: No such file or directory, c'est que le fichier comporte déjà la ligne #include <servo.h>

Il faut donc installer la librairie :

Menu Outils / Gérer les bibliothèques.
Chercher Servo (Champ "Filtrez votre recherche").

Philppe, j'ai mis ton code entre balises CODE, comme indiqué ici :

Qu'il serait bien de lire pour la prochaine fois :wink:

Apparemment la librairie Arduino Servo ne convient pas.
Il s'agit probablement de celle-ci :
https://wikifactory.com/+OttoDIY/otto-diy/contributions/81b7e735501c7fcfbcf87f3eb928282150ec392d

On la trouve également dans le gestionnaire de bibliothèques en recherchant otto.

merci pour la correction :grinning:

Le nom de la bibliothèque est 'Servo.h' et non 'servo.h'

S'il s'agit bien de la librairie Otto, il s'agit plutôt de Otto.h.
Philppe devrait nous dire où il a pêché ce code, ou s'il l'a écrit lui-même.

Normalement ta librairie est deje installé...Je pense que tu a mal defini l'emplacement du sketchbook,c'est dans:fichier<preference<sketchbook.Clique sur parcourir et bidouillle un peu...
Bon courage :space_invader:

deja pardon de pas pour les balises
j'ai trouver le code sur internet
GitHub - vishalsoniindia/Arduino_Otto_Robot: This is the Otto robot code with library you can easily make this arduino robot. it is a simple arduino project.

et encore merci a tous pour votre aide

maintenant j ai ca
C:\Users\user\OneDrive\Documents\Arduino\Arduino_Otto_Robot\Arduino_Otto_Robot.ino:6:10: fatal error: Adafruit_LEDBackpack.h: No such file or directory
#include <Adafruit_LEDBackpack.h>
^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

exit status 1

Compilation error: Adafruit_LEDBackpack.h: No such file or directory

Désolé, mais je ne vois pas d'où provient ton fichier Arduino_Otto_Robot.ino
Ton problème est similaire au premier, il suffit de chercher une librairie Adafruit_LEDBackpack et de l'installer.
Tu devrais commencer par une formation de base ARDUINO plutôt que de foncer tête baissée dans un projet aussi complexe.

bonjour, y a du progrès
maintenant j'ai ce message

C:\Users\user\OneDrive\Documents\Arduino\Arduino_Otto_Robot\Arduino_Otto_Robot_copy_20230124214243\Arduino_Otto_Robot_copy_20230124214243.ino:22:10: fatal error: Otto9.h: No such file or directory
#include <Otto9.h>
^~~~~~~~~
compilation terminated.
Plusieurs bibliothèque trouvées pour "Otto.h"
Utilisé: C:\Users\user\OneDrive\Documents\Arduino\libraries\OttoDIYLib
Non utilisé: C:\Users\user\OneDrive\Documents\Arduino\libraries\OttoDIYLib-master
exit status 1

Compilation error: Otto9.h: No such file or directory
donc ma bibliothèque est installée ?

merci encore une fois pour votre aide

c'est possible de supprimer ce qui sert a rien je veux juste le détecteur et les ' servos pour que le robot évites les obstacles

#include <Otto.h>

#include <Arduino_LSM6DS3.h>

#include <WiFiNINA.h>

#include <Otto.h>

#include <Otto.h>


#include <Adafruit_LEDBackpack.h>
#include <Adafruit_NeoPixel.h>

#include <BatReader9.h>
#include <EnableInterrupt.h>
#include <Oscillator.h>
#include <Otto9.h>
#include <Otto9Humanoid.h>
#include <OttoSerialCommand.h>
#include <Otto_Matrix9.h>
#include <Otto_gestures9.h>
#include <Otto_mouth9.h>
#include <Otto_sound9.h>
#include <SerialCommand.h>
#include <TimerFreeTone.h>
#include <US.h>
#include <gfxfont.h>

#include <servo.h>

#include <servo.h>  //-- Otto Library version 9
servo;              //This is Otto!
//---------------------------------------------------------
// Face should be in front of you
/*
                 --------------- 
                |     O   O     |
                |---------------|
Left leg =>     |               |    <= Right leg
                 --------------- 
                    ||     ||
Left foot =>     -----   ------     <= Right foot
                 |-----   ------|
*/
// SERVO PINs //////////////////////////////////////////////////////////////////////////////
#define PIN_YL 8   //servo[0]  left leg
#define PIN_YR 9   //servo[1]  right leg
#define PIN_RL 1























































0  //servo[2]  left foot
#define PIN_RR 11  //servo[3]  right foot
// ULTRASONIC PINs /////////////////////////////////////////////////////////////////////////
#define PIN_Trigger 2  //TRIGGER pin (2)
#define PIN_Echo 3     //ECHO pin (3)
// BUZZER PIN //////////////////////////////////////////////////////////////////////////////
#define PIN_Buzzer 13  //BUZZER pin (13)
// SERVO ASSEMBLY PIN   /////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//-- Global Variables -------------------------------------------//
///////////////////////////////////////////////////////////////////
int distance;                   // variable to store distance read from ultrasonic range finder module
bool obstacleDetected = false;  // logic state for when object detected is at the distance we set
bool obstacleFlag = true;
//-- Movement parameters
int T = 1000;       //Initial duration of movement
int moveId = 0;     //Number of movement
int moveSize = 15;  //Asociated with the height of some movements
int move = 0;
///////////////////////////////////////////////////////////////////
//-- Setup ------------------------------------------------------//
///////////////////////////////////////////////////////////////////
void setup() {
  Serial.begin(19200);
  Otto.init(PIN_YL, PIN_YR, PIN_RL, PIN_RR, true, A6, PIN_Buzzer, PIN_Trigger, PIN_Echo);  //Set the servo pins and ultrasonic pins and Buzzer pin
  //Otto wake up!
  Otto.sing(S_connection);  // Otto makes a sound
  Otto.home();              // Otto moves to its ready position
  delay(500);               // wait for 500 milliseconds to allow Otto to stop
}

void loop() {
  obstacleDetector();

  if (obstacleDetected == true && obstacleFlag == true) {
    Otto.playGesture(OttoConfused);
    obstacleFlag = false;
  }

  if (obstacleDetected == false && obstacleFlag == false) {
    move = random(1, 27);
    obstacleFlag = true;
  }

  switch (move) {
    case 1:
      Otto.walk(2, 1000, 1);
      Otto.home();
      move = 0;
      break;
    case 2:
      Otto.walk(2, 1000, -1);
      Otto.home();
      move = 0;
      break;
    case 3:
      Otto.turn(2, 1000, 1);
      Otto.home();
      move = 0;
      break;
    case 4:
      Otto.turn(2, 1000, -1);
      Otto.home();
      move = 0;
      break;
    case 5:
      Otto.bend(2, 500, 1);
      Otto.home();
      move = 0;
      break;
    case 6:
      Otto.bend(2, 2000, -1);
      Otto.home();
      move = 0;
      break;
    case 7:
      Otto.shakeLeg(2, 1500, 1);
      Otto.home();
      move = 0;
      break;
    case 8:
      Otto.moonwalker(3, 1000, 25, 1);
      Otto.home();
      move = 0;
      break;
    case 9:
      Otto.moonwalker(3, 1000, 25, -1);
      Otto.home();
      move = 0;
      break;
    case 10:
      Otto.crusaito(2, 1000, 20, 1);
      Otto.home();
      move = 0;
      break;
    case 11:
      Otto.crusaito(2, 1000, 20, -1);
      Otto.home();
      move = 0;
      break;
    case 12:
      Otto.flapping(2, 1000, 20, 1);
      Otto.home();
      move = 0;
      break;
    case 13:
      Otto.flapping(2, 1000, 20, -1);
      Otto.home();
      move = 0;
      break;
    case 14:
      Otto.swing(2, 1000, 20);
      Otto.home();
      move = 0;
      break;
    case 15:
      Otto.tiptoeSwing(2, 1000, 20);
      Otto.home();
      move = 0;
      break;
    case 16:
      Otto.jitter(2, 1000, 20);  //(small T)
      Otto.home();
      move = 0;
      break;
    case 17:
      Otto.updown(2, 1500, 20);  // 20 = H "HEIGHT of movement"T
      Otto.home();
      move = 0;
      break;
    case 18:
      Otto.ascendingTurn(2, 1000, 50);
      Otto.home();
      move = 0;
      break;
    case 19:
      Otto.jump(1, 500);  // It doesn't really jumpl ;P
      Otto.home();
      move = 0;
      break;
    case 20:
      Otto.playGesture(OttoSuperHappy);
      Otto.home();
      move = 0;
      break;
    case 21:
      Otto.playGesture(OttoSad);
      Otto.home();
      move = 0;
      break;
    case 22:
      Otto.playGesture(OttoVictory);
      Otto.home();
      move = 0;
      break;
    case 23:
      Otto.playGesture(OttoAngry);
      Otto.home();
      move = 0;
      break;
    case 24:
      Otto.playGesture(OttoSleeping);
      Otto.home();
      move = 0;
      break;
    case 25:
      Otto.playGesture(OttoLove);
      Otto.home();
      move = 0;
      break;
    case 26:
      Otto.playGesture(OttoFart);
      Otto.home();
      move = 0;
      break;
    case 27:
      Otto.playGesture(OttoFail);
      Otto.home();
      move = 0;
      break;
  }
}

void obstacleDetector() {
  int distance = Otto.getDistance();           // get the distance from the ultrasonic range finder
  if (distance < 15) obstacleDetected = true;  // check to see if this distance is closer than 15cm, true if it is
  else obstacleDetected = false;               // false if it is not
  Serial.print(distance);
  Serial.println("cm");
  if (distance < 15) {
    obstacleDetected = true;
    Serial.println("Obstacle Detected! Avoid collision");
  } else {
    obstacleDetected = false;
    Serial.println("No Obstacle detected! - Keep on walking");
  }
}