Partage
  • Partager sur Facebook
  • Partager sur Twitter

Controller 2 ESC avec 1 potentiomètre

    26 mars 2019 à 10:11:41

    Bonjour,

    je possède 2 ESC (electronic speed controller ) qui controllent des moteurs brushless ( https://hobbyking.com/en_us/hobbyking-donkey-st3511-810kv-brushless-power-system-combo.html?gclid=CjwKCAjwm-fkBRBBEiwA966fZNUs_Lq5O0I9nkySMYFtYdEYreK2LXFlR0XGbOV2MIj9oXWXFvWRkxoCAhEQAvD_BwE&gclsrc=aw.ds&___store=en_us). Je voudrais les faire marcher avec un poentiomètre sous arduino. 

    J'ai un programme mais cela ne fais marcher qu'un seul moteur. Voici le programme :

    "#include <Servo.h>//Using servo library to control ESC

    Servo esc;
    Servo esc2;
    //Creating a servo class with name as esc

    void setup()

    {

    esc.attach(9); //Specify the esc signal pin,Here as D8

    esc.writeMicroseconds(1000); //initialize the signal to 1000

    Serial.begin(9600);

    esc2.attach(9); //Specify the esc signal pin,Here as D8

    esc2.writeMicroseconds(1000); //initialize the signal to 1000

    Serial.begin(9600);

    }

    void loop()

    {

    int val; //Creating a variable val


    val= analogRead(A0); //Read input from analog pin a0 and store in val

    val= map(val, 0, 1023,1000,2000); //mapping val to minimum and maximum(Change if needed)

    esc.writeMicroseconds(val); //using val as the signal to esc
    esc2.writeMicroseconds(val);
    } "

    Je n'ai pas trouvé d'aide sur internet, merci d'avance.

    • Partager sur Facebook
    • Partager sur Twitter
      28 mars 2019 à 4:34:13

      Bonjour,

      Au-dessus de la saisi du text, tu as des icônes, dont un qui te permet de poser du code. Sa permet de donner de la clarté au message, et de saisir le code plus simplement..

      Je ne suis pas au fait de cette bibliothèque <servo> mais..

      #include <Servo.h>//Using servo library to control ESC
      
      Servo esc;
      Servo esc2;
      //Creating a servo class with name as esc
      
      void setup()
      
      {
      
      esc.attach(9); //Specify the esc signal pin,Here as D8
      
      esc.writeMicroseconds(1000); //initialize the signal to 1000
      
      Serial.begin(9600);
      
      esc2.attach(9); //Specify the esc signal pin,Here as D8
      
      esc2.writeMicroseconds(1000); //initialize the signal to 1000
      
      Serial.begin(9600);
      
      }
      
      void loop()
      
      {
      
      int val; //Creating a variable val
      
      
      val= analogRead(A0); //Read input from analog pin a0 and store in val
      
      val= map(val, 0, 1023,1000,2000); //mapping val to minimum and maximum(Change if needed)
      
      esc.writeMicroseconds(val); //using val as the signal to esc
      esc2.writeMicroseconds(val);
      } 

      Je vois déjà quelque truc a redire..

      Dans ton setup, un seul serial.begin ;

      "esc.attach(9); //Specify the esc signal pin,Here as D8" ton esc1 est attaché a la pin9, incohérent avec le commentaire

      "esc2.attach(9); //Specify the esc signal pin,Here as D8" Idem, qui plus est, ne peux être branché sur la même sortie digital que l'esc1!

      • Partager sur Facebook
      • Partager sur Twitter

      Controller 2 ESC avec 1 potentiomètre

      × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
      × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
      • Editeur
      • Markdown