Banc d'essai voiture de modelisme

Bonjour à tous,

Je vous explique mon projet en quelques mots, je veux réaliser un banc de test pour mes voiture de modélisme.
Dans un premier temps, je voudrais juste pouvoir tester l'autonomie de mes batteries avant de rentrer plus dans les détails (tours moteur, vitesse ...)

J'ai donc commencer à réaliser plusieurs chose:

  • Un schéma électrique du câblage en pièce jointe. à noter que le variateur représenter n'est pas celui qui sera utilisé réellement.
  • Le banc d'essai tel qu'il sera à voir sur la photo, le câblage n'est pas encore fait
  • Et le programme que je vais mettre plus bas avec les problèmes que je rencontre déjà en faisant la compilation.

Fonctionnement du banc:

  • J'ai prévu deux modes de fonctionnement, 1 en manuel et 1 en automatique, la sélection se ferait via un inter 3 positions
  • Mode manuel dans le quel je peux me servir de la direction et de l'accélération à l'aide de potentiomètre
  • Mode automatique dans lequel souhaiterais faire tourner en boucle une courbe moteur dans le style de celle en pièce jointe que j'ai trouver sur le net. Je lancerais et j'arrêterais cette boucle de programmation avec un inter "pullup"

Etant assez novice dans la programmation, je rencontre plusieurs problème:

  • Le code ci dessous ne fonctionne pas en compilation et je n'arrive pas à voir ou ça cloche
  • Je ne sais pas si mon inter Start / Stop du programme est bien programmé
  • Je n'ai aucune idée de comment réaliser la boucle de fonctionnement de mon mode automatique, actuellement je l'ai mis avec les sorties à l'état haut

Le code:

/
// Programme bance de test

// Nom des entrées / sorties
#include <Servo.h>

Servo Moteur;
Servo Direction;

const byte InterMANU = 8;              // Choix mode manuel
const byte InterAUTO = 7;              // Choix mode automatique
const byte InterSTARTSTOP = 6;         // Impulsion de mise en route ou mise à l'arret mode auto
const byte potmot = A0;                // Signal entree carte pour reglage de la vitesse
const byte potdir = A1;                // Signal entree carte pour reglage de la direction 
const byte SortieMoteur = 10;          // Signal sortie carte vers ESC
const byte SortieDirection = 9;        // Signal sortie carte vers Servo de direction



// Définition des entrées / sorties
void setup()
{
  pinMode(InterMANU, INPUT);                // Interrupteur position mode manuel
  pinMode(InterAUTO, INPUT);                // Interrupteur position mode automatique
  pinMode(InterSTARTSTOP, INPUT_PULLUP);    // Interrupteur impulsion de mise en route ou mise à l'arret mode auto
  pinMode(potmot, INPUT);                   // Signal entree carte pour reglage de la vitesse
  pinMode(potdir, INPUT);                   // Signal entree carte pour reglage de la direction   
  pinMode(SortieMoteur, OUTPUT);            // Signal sortie carte vers ESC
  pinMode(SortieDirection, OUTPUT);         // Signal sortie carte vers Servo de direction 
  
  Serial.begin(9600);
  Moteur.attach(10);
  Direction.attach(9);
  int digitalRead(InterSTARTSTOP, HIGH);
  int valpotmot;
  int valpotdir;
}

// Programme
void loop() 
{
  if (InterMANU == HIGH){                     // Utilisation du mode manuel avec les deux potentiomètre  
    // Prog moteur
    valpotmot = analogRead(potmot);
    Serial.print("valpotmot:");
    Serial.print(valpotmot);
    SortieMoteur = map(valpotmot, 0, 1023, 0, 179);
    Serial.print(", SortieMoteur: ");
    Serial.println(SortieMoteur);
    Moteur.write(SortieMoteur);
    //Prog direction
    valpotdir = analogRead(potdir);
    Serial.print("valpotdir:");
    Serial.print(valpotdir);
    SortieMoteur = map(valpotdir, 0, 1023, 0, 179);
    Serial.print(", SortieMoteur: ");
    Serial.println(SortieMoteur);
    Direction.write(SortieMoteur);
  }
  else if (InterAUTO == HIGH){       // Utilisation du mode automatique
  
   int InterSTARTSTOP = digitalRead(6); // Lecture de l'interrupteur Start / Stop
   Serial.println(InterSTARTSTOP); //print out the value of the pushbutton
   if (InterSTARTSTOP == HIGH){
     analogWrite(A0, LOW);
     analogWrite(A1, LOW);
   } 
   else (InterSTARTSTOP == LOW){
     analogWrite(A0, HIGH);   // le but de cette partie étant de remplacer les sortie par le graphique de la courbe moteur qui tournerait en boucle
     analogWrite(A1, HIGH);   // le but de cette partie étant de remplacer les sortie par le graphique de la courbe moteur qui tournerait en boucle
   }
  }
}
    /[code]

Voilà, bon si quelqu'un peu me donner un coup de main, je le remercie par avance
Philippe

courbe moteur.gif

Schéma-banc-d-essai.pdf (947 KB)

Banc moteur réel.JPG

La nuit pourtant conseil après quelques modifications la compilation marche, reste plus qu'à trouver pour la boucle du mode auto

le nouveau code

/
// Programme bance de test

// Nom des entrées / sorties
#include <Servo.h>

Servo Moteur;
Servo Direction;

const byte InterMANU = 8;              // Choix mode manuel
const byte InterAUTO = 7;              // Choix mode automatique
const byte InterSTARTSTOP = 6;         // Impulsion de mise en route ou mise à l'arret mode auto
const byte potmot = A0;                // Signal entree carte pour reglage de la vitesse
const byte potdir = A1;                // Signal entree carte pour reglage de la direction 
int SortieMoteur = 10;          // Signal sortie carte vers ESC
int SortieDirection = 9;        // Signal sortie carte vers Servo de direction
int valpotmot;
int valpotdir;


// Définition des entrées / sorties
void setup()
{
  pinMode(InterMANU, INPUT);                // Interrupteur position mode manuel
  pinMode(InterAUTO, INPUT);                // Interrupteur position mode automatique
  pinMode(InterSTARTSTOP, INPUT_PULLUP);    // Interrupteur impulsion de mise en route ou mise à l'arret mode auto
  pinMode(potmot, INPUT);                   // Signal entree carte pour reglage de la vitesse
  pinMode(potdir, INPUT);                   // Signal entree carte pour reglage de la direction   
  pinMode(SortieMoteur, OUTPUT);            // Signal sortie carte vers ESC
  pinMode(SortieDirection, OUTPUT);         // Signal sortie carte vers Servo de direction 
  
  Serial.begin(9600);
  Moteur.attach(10);
  Direction.attach(9);

}

// Programme
void loop() 
{
  if (InterMANU == HIGH){                     // Utilisation du mode manuel avec les deux potentiomètre  
    // Prog moteur
    valpotmot = analogRead(potmot);
    Serial.print("valpotmot:");
    Serial.print(valpotmot);
    SortieMoteur = map(valpotmot, 0, 1023, 0, 179);
    Serial.print(", SortieMoteur: ");
    Serial.println(SortieMoteur);
    Moteur.write(SortieMoteur);
    //Prog direction
    valpotdir = analogRead(potdir);
    Serial.print("valpotdir:");
    Serial.print(valpotdir);
    SortieDirection = map(valpotdir, 0, 1023, 0, 179);
    Serial.print(", SortieDirection: ");
    Serial.println(SortieDirection);
    Direction.write(SortieDirection);
  }
  else (InterAUTO == HIGH);{       // Utilisation du mode automatique
  
   int InterSTARTSTOP = digitalRead(6); // Lecture de l'interrupteur Start / Stop
   Serial.println(InterSTARTSTOP); // Enregistrement de la valeur du bouton poussoir
   if (InterSTARTSTOP == HIGH){
     analogWrite(A0, LOW);
     analogWrite(A1, LOW);
   } 
   else (InterSTARTSTOP == LOW);{
     analogWrite(A0, HIGH);   // le but de cette partie étant de remplacer les sortie par le graphique de la courbe moteur qui tournerait en boucle
     analogWrite(A1, HIGH);   // le but de cette partie étant de remplacer les sortie par le graphique de la courbe moteur qui tournerait en boucle
   }
  }
}
/[Code]

hello
une suggestion:

// Programme banc de test

// Nom des entrées / sorties
#include <Servo.h>

Servo Moteur;
Servo Direction;

const byte InterMANU = 8;              // Choix mode manuel
const byte InterAUTO = 7;              // Choix mode automatique
const byte InterSTARTSTOP = 6;         // Impulsion de mise en route ou mise à l'arret mode auto
const byte potmot = A0;                // Signal entree carte pour reglage de la vitesse
const byte potdir = A1;                // Signal entree carte pour reglage de la direction
int SortieMoteur = 10;          // Signal sortie carte vers ESC
int SortieDirection = 9;        // Signal sortie carte vers Servo de direction
int valpotmot;
int valpotdir;


// Définition des entrées / sorties
void setup()
{
  pinMode(InterMANU, INPUT);                // Interrupteur position mode manuel
  pinMode(InterAUTO, INPUT);                // Interrupteur position mode automatique
  pinMode(InterSTARTSTOP, INPUT_PULLUP);    // Interrupteur impulsion de mise en route ou mise à l'arret mode auto
  pinMode(potmot, INPUT);                   // Signal entree carte pour reglage de la vitesse
  pinMode(potdir, INPUT);                   // Signal entree carte pour reglage de la direction
  pinMode(SortieMoteur, OUTPUT);            // Signal sortie carte vers ESC
  pinMode(SortieDirection, OUTPUT);         // Signal sortie carte vers Servo de direction

  Serial.begin(9600);
  Moteur.attach(10);
  Direction.attach(9);

}

// Programme
void loop()
{
  if (InterMANU == HIGH) {                    // Utilisation du mode manuel avec les deux potentiomètre
    // Prog moteur
    valpotmot = analogRead(potmot);
    Serial.print("valpotmot:");
    Serial.print(valpotmot);
    SortieMoteur = map(valpotmot, 0, 1023, 0, 179);
    Serial.print(", SortieMoteur: ");
    Serial.println(SortieMoteur);
    Moteur.write(SortieMoteur);
    //Prog direction
    valpotdir = analogRead(potdir);
    Serial.print("valpotdir:");
    Serial.print(valpotdir);
    SortieDirection = map(valpotdir, 0, 1023, 0, 179);
    Serial.print(", SortieDirection: ");
    Serial.println(SortieDirection);
    Direction.write(SortieDirection);
  }
  else if (InterAUTO == HIGH)
  { // Utilisation du mode automatique

    int InterSTARTSTOP = digitalRead(6); // Lecture de l'interrupteur Start / Stop
    Serial.println(InterSTARTSTOP); // Enregistrement de la valeur du bouton poussoir
    if (InterSTARTSTOP == HIGH)
    {
      valpotmot =  LOW; Serial.print("valpotmot:"); Serial.print(valpotmot);
      SortieMoteur = map(valpotmot, 0, 1023, 0, 179); Serial.print(", SortieMoteur: "); Serial.println(SortieMoteur);
      Moteur.write(SortieMoteur);
      valpotdir =  LOW; Serial.print("valpotdir:"); Serial.print(valpotdir);
      SortieDirection = map(valpotdir, 0, 1023, 0, 179); Serial.print(", SortieDirection: "); Serial.println(SortieDirection);
      Direction.write(SortieDirection);
    }
    else                                     //(InterSTARTSTOP == LOW);
    {
      for (int f = 0; f < 256; f++)
      {
        valpotmot =  f; Serial.print("valpotmot:"); Serial.print(valpotmot);
        SortieMoteur = map(valpotmot, 0, 1023, 0, 179); Serial.print(", SortieMoteur: "); Serial.println(SortieMoteur);
        Moteur.write(SortieMoteur);
        valpotdir =  f; Serial.print("valpotdir:"); Serial.print(valpotdir);
        SortieDirection = map(valpotdir, 0, 1023, 0, 179); Serial.print(", SortieDirection: "); Serial.println(SortieDirection);
        Direction.write(SortieDirection);
        delay(1000);
      }
      for (int f = 256; f >= 0; f--)
      {
        valpotmot =  f; Serial.print("valpotmot:"); Serial.print(valpotmot);
        SortieMoteur = map(valpotmot, 0, 1023, 0, 179); Serial.print(", SortieMoteur: "); Serial.println(SortieMoteur);
        Moteur.write(SortieMoteur);
        valpotdir =  f; Serial.print("valpotdir:"); Serial.print(valpotdir);
        SortieDirection = map(valpotdir, 0, 1023, 0, 179); Serial.print(", SortieDirection: "); Serial.println(SortieDirection);
        Direction.write(SortieDirection);
        delay(1000);
      }
    }
  }
}

Merci pour la réponse,

Je vais essayer de voir si ca marche mais j'ai un pb de câblage sur mon banc de test

Bonjour,

J'ai modifié le code car j'ai mis un interrupteur 2 position à la place de l'inter à impulsion.
Donc j'ai remis le schéma en pièce jointe ainsi que la photo du câblage réel.

J'ai un problème de connexion. Quand mes potentiomètres sont aux mini, je penses qu'il sont trop résistant du coup j'ai l'impression que la carte n'est plus alimenté. Mais je sais pas si c'est réellement ça le problème. Si quelqu'un peut m'éclairer ? Est ce que je peux alimenter la moitié de ma platine à partir de l'ESC moteur vu qu'il y a un BEC ?

Voilà le nouveau code mais je n'ai tjs pas trouver une solutions pour ce qui est du mode automatique au niveau de la programmation, j'ai inclue la solution de dfgh mais vue que j'ai un pb sur mes branchement je ne peux pas tester .

 / 
// Programme banc de test

// Nom des entrées / sorties
#include <Servo.h>

Servo Moteur;
Servo Direction;

const byte InterMANU = 8;              // Choix mode manuel
const byte InterAUTO = 7;              // Choix mode automatique
const byte InterSTART = 6;             // Mise en route mode auto
const byte InterSTOP = 5;              // Mise à l'arret mode auto
const byte potmot = A0;                // Signal entree carte pour reglage de la vitesse
const byte potdir = A1;                // Signal entree carte pour reglage de la direction 
int SortieMoteur = 10;          // Signal sortie carte vers ESC
int SortieDirection = 9;        // Signal sortie carte vers Servo de direction
int valpotmot;
int valpotdir;


// Définition des entrées / sorties
void setup()
{
  pinMode(InterMANU, INPUT);                // Interrupteur position mode manuel
  pinMode(InterAUTO, INPUT);                // Interrupteur position mode automatique
  pinMode(InterSTART, INPUT);               // Mise en route  mode auto
  pinMode(InterSTOP, INPUT);                // Mise à l'arret mode auto  
  pinMode(potmot, INPUT);                   // Signal entree carte pour reglage de la vitesse
  pinMode(potdir, INPUT);                   // Signal entree carte pour reglage de la direction   
  pinMode(SortieMoteur, OUTPUT);            // Signal sortie carte vers ESC
  pinMode(SortieDirection, OUTPUT);         // Signal sortie carte vers Servo de direction 
  
  Serial.begin(9600);
  Moteur.attach(10);
  Direction.attach(9);

}

// Programme
void loop() 
{
  if (InterMANU == HIGH){                     // Utilisation du mode manuel avec les deux potentiomètre  
    // Prog moteur
    valpotmot = analogRead(potmot);
    Serial.print("valpotmot:");
    Serial.print(valpotmot);
    SortieMoteur = map(valpotmot, 0, 1023, 0, 179);
    Serial.print(", SortieMoteur: ");
    Serial.println(SortieMoteur);
    Moteur.write(SortieMoteur);
    //Prog direction
    valpotdir = analogRead(potdir);
    Serial.print("valpotdir:");
    Serial.print(valpotdir);
    SortieDirection = map(valpotdir, 0, 1023, 0, 179);
    Serial.print(", SortieDirection: ");
    Serial.println(SortieDirection);
    Direction.write(SortieDirection);
  }
  else (InterAUTO == HIGH);{       // Utilisation du mode automatique
  
   int InterSTART = digitalRead(6); // Lecture de l'interrupteur Start / Stop
   Serial.println(InterSTART); // Enregistrement de la valeur du bouton poussoir
   if (InterSTART == HIGH){
    
      valpotmot =  LOW; Serial.print("valpotmot:"); Serial.print(valpotmot);
      SortieMoteur = map(valpotmot, 0, 1023, 0, 179); Serial.print(", SortieMoteur: "); Serial.println(SortieMoteur);
      Moteur.write(SortieMoteur);
      valpotdir =  LOW; Serial.print("valpotdir:"); Serial.print(valpotdir);
      SortieDirection = map(valpotdir, 0, 1023, 0, 179); Serial.print(", SortieDirection: "); Serial.println(SortieDirection);
      Direction.write(SortieDirection);
   } 
   else (InterSTOP == HIGH);{
      
      for (int f = 0; f < 256; f++)
      {
        valpotmot =  f; Serial.print("valpotmot:"); Serial.print(valpotmot);
        SortieMoteur = map(valpotmot, 0, 1023, 0, 179); Serial.print(", SortieMoteur: "); Serial.println(SortieMoteur);
        Moteur.write(SortieMoteur);
        valpotdir =  f; Serial.print("valpotdir:"); Serial.print(valpotdir);
        SortieDirection = map(valpotdir, 0, 1023, 0, 179); Serial.print(", SortieDirection: "); Serial.println(SortieDirection);
        Direction.write(SortieDirection);
        delay(1000);
      }
      for (int f = 256; f >= 0; f--)
      {
        valpotmot =  f; Serial.print("valpotmot:"); Serial.print(valpotmot);
        SortieMoteur = map(valpotmot, 0, 1023, 0, 179); Serial.print(", SortieMoteur: "); Serial.println(SortieMoteur);
        Moteur.write(SortieMoteur);
        valpotdir =  f; Serial.print("valpotdir:"); Serial.print(valpotdir);
        SortieDirection = map(valpotdir, 0, 1023, 0, 179); Serial.print(", SortieDirection: "); Serial.println(SortieDirection);
        Direction.write(SortieDirection);
        delay(1000);
   }
  }
}
}
   

/ [code]

hello
valeur des potars?
valeur des push down?

ton "schéma" semble correct
es tu sur de l'avoir respecté sur ta maquette?

Bonjour,

La valeurs des potars est de 10K, j'ai résolu le problème des branchements suivants le plan joint.

Mais ça ne marche toujours pas, je vais essayer de faire un autre programme

Bonjour,

J'ai résolu mes problèmes de branchement et ça marche.

J'ai fais un code simplifié pour le mode manuel et ca marche.

[code/]
// Programme bance de test

// Nom des entrées / sorties
#include <Servo.h>

Servo Moteur;
Servo Direction;

const byte InterMANU = 8;              // Choix mode manuel
const byte InterAUTO = 7;              // Choix mode automatique
const byte InterSTART = 6;             // Mise en route mode auto
const byte InterSTOP = 5;              // Mise à l'arret mode auto
const byte potmot = A0;                // Signal entree carte pour reglage de la vitesse
const byte potdir = A1;                // Signal entree carte pour reglage de la direction 
int SortieMoteur = 10;          // Signal sortie carte vers ESC
int SortieDirection = 2;        // Signal sortie carte vers Servo de direction
int valpotmot;
int valpotdir;


// Définition des entrées / sorties
void setup()
{
  pinMode(InterMANU, INPUT);                // Interrupteur position mode manuel
  pinMode(InterAUTO, INPUT);                // Interrupteur position mode automatique
  pinMode(InterSTART, INPUT);               // Mise en route  mode auto
  pinMode(InterSTOP, INPUT);                // Mise à l'arret mode auto  
  pinMode(potmot, INPUT);                   // Signal entree carte pour reglage de la vitesse
  pinMode(potdir, INPUT);                   // Signal entree carte pour reglage de la direction   
  pinMode(SortieMoteur, OUTPUT);            // Signal sortie carte vers ESC
  pinMode(SortieDirection, OUTPUT);         // Signal sortie carte vers Servo de direction 
  
  Moteur.attach(10);
  Direction.attach(2);
  Serial.begin(9600);

}

// Programme
void loop() 
{
  // Utilisation du mode manuel avec les deux potentiomètre  
    // Prog moteur
    valpotmot = analogRead(potmot);
    SortieMoteur = map(valpotmot, 0, 1023, 0, 179);
    Moteur.write(SortieMoteur);
    //Prog direction
    valpotdir = analogRead(potdir);
    SortieDirection = map(valpotdir, 0, 1023, 0, 179);
    Direction.write(SortieDirection);
  }

par contre quand j'essaye d'intégrer mon code de mode automatique ca ne marche pas

// Programme bance de test

// Nom des entrées / sorties
#include <Servo.h>

Servo Moteur;
Servo Direction;

const byte InterMANU = 8; // Choix mode manuel
const byte InterAUTO = 7; // Choix mode automatique
const byte InterSTART = 6; // Mise en route mode auto
const byte InterSTOP = 9; // Mise à l'arret mode auto
const byte potmot = A0; // Signal entree carte pour reglage de la vitesse
const byte potdir = A1; // Signal entree carte pour reglage de la direction 
int SortieMoteur = 5; // Signal sortie carte vers ESC
int SortieDirection = 3; // Signal sortie carte vers Servo de direction
int valpotmot; // Valeur potentiomère moteur 
int valpotdir; // Valeur potentiomère direction
int valmotauto; // Valeur auto moteur
int valdirauto; // Valeur auto direction

// Définition des entrées / sorties
void setup()
{
pinMode(InterMANU, INPUT); // Interrupteur position mode manuel
pinMode(InterAUTO, INPUT); // Interrupteur position mode automatique
pinMode(InterSTART, INPUT); // Mise en route mode auto
pinMode(InterSTOP, INPUT); // Mise à l'arret mode auto 
pinMode(potmot, INPUT); // Signal entree carte pour reglage de la vitesse
pinMode(potdir, INPUT); // Signal entree carte pour reglage de la direction 
pinMode(SortieMoteur, OUTPUT); // Signal sortie carte vers ESC
pinMode(SortieDirection, OUTPUT); // Signal sortie carte vers Servo de direction 

Moteur.attach(10);
Direction.attach(2);
Serial.begin(9600);

}

// Programme
void loop() 
{
// Utilisation du mode manuel avec les deux potentiomètre 
if (InterMANU == HIGH){
// Prog moteur
valpotmot = analogRead(potmot);
SortieMoteur = map(valpotmot, 0, 1023, 0, 179);
Moteur.write(SortieMoteur);
//Prog direction
valpotdir = analogRead(potdir);
SortieDirection = map(valpotdir, 0, 1023, 0, 179);
Direction.write(SortieDirection);
}

// Utilisation du mode automatique
else (InterAUTO == HIGH);{ 

int InterSTART = digitalRead(6); // Lecture de l'interrupteur Start / Stop
Serial.println(InterSTART); // Enregistrement de la valeur du bouton poussoir
if (InterSTART == HIGH){
// Coupure des entrées potentiomètres 
valpotmot = LOW; 
valpotdir = LOW;

// Boucle de programmations auto 
// Pour info delai noté en ms soit 1seconde = 1000
do {

//Boucle moteur 1 
// Prog moteur
valmotauto = 50;
SortieMoteur = map(valmotauto, 0, 1023, 0, 179);
Moteur.write(SortieMoteur);
delay(10000);
//Prog direction
valdirauto = 50;
SortieDirection = map(valdirauto, 0, 1023, 0, 179);
Direction.write(SortieDirection);
delay(10000);
//Boucle moteur 2 
// Prog moteur
valmotauto = 80;
SortieMoteur = map(valmotauto, 0, 1023, 0, 179);
Moteur.write(SortieMoteur);
delay(10000);
//Prog direction
valdirauto = 20;
SortieDirection = map(valdirauto, 0, 1023, 0, 179);
Direction.write(SortieDirection);
delay(10000);
} 
while (InterSTOP == HIGH);

} 
else (InterSTOP == HIGH);{
// Signaux de sortie à zéro 
digitalWrite (SortieMoteur, LOW);
digitalWrite (SortieMoteur, LOW);
}
}

} 

Si quelqu'un a une idée, je suis preneur

hello
aujourd'hui, je n'ai pas le temps, mais entre tes 2 prg, tu n'as pas les memes affectations de constantes pour les entrées/sorties.
lorsque tu testes, tu modifies bien ton cablage pour etre conforme aux affectations ?

Salut

Oui j'ai vu j'ai modifié mais c'est pareil

hello
corriges là:

// Utilisation du mode automatique
else (InterAUTO == HIGH);{

devient:

// Utilisation du mode automatique
else { //(InterAUTO == HIGH);

int InterSTART = digitalRead(6); // Lecture de l'interrupteur Start / Stop

Bonjour,

Bon ça n'a pas marché.

J'ai refait un programme complet qui me parait logique mais ça fonctionne pas au niveau des conditions d'utilisations des interrupteur.
J'ai fait le programme en testant au fur et à mesure:

  • La boucle de fonctionnement manuel avec les deux potars marche
  • La boucle de fonctionnement auto marche
    Des que j'intègre les conditions plus rien fonctionne.

Ci joint le code:

// Programme banc de test
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Nom des entrées / sorties
// Interrupteur choix du mode
const byte InterMANU = 8;                 // Choix mode manuel
const byte InterAUTO = 7;                 // Choix mode automatique
// Potentiomère mode manuel
// const byte potmot = A0;                // Signal entree carte pour reglage de la vitesse
// const byte potdir = A1;                // Signal entree carte pour reglage de la direction
// Interrupteur mode auto
const byte InterSTART = 6;                // Mise en route mode auto
const byte InterSTOP = 5;                 // Mise à l'arret mode auto
// Moteur 
#include <Servo.h>
Servo Moteur;
int SortieMoteur = 10;                    // Signal sortie carte vers ESC
int const potmot = A0; 
int valpotmot;
// Direction
#include <Servo.h>
Servo Direction;
int const potdir = A1;
int SortieDirection = 2;                  // Signal sortie carte vers Servo de direction
int valpotdir;
// Mode AUTO
int valmotauto;                           // Valeur auto moteur
int valdirauto;                           // Valeur auto direction
// Variable etat interrupteur
byte etatInterMANU;
byte etatInterAUTO;
byte etatInterSTART;
byte etatInterSTOP;

// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Définition des entrées / sorties
void setup()
{
 
// Broche d'entree
  pinMode(InterMANU, INPUT);                // Interrupteur position mode manuel
  pinMode(InterAUTO, INPUT);                // Interrupteur position mode automatique
  pinMode(InterSTART, INPUT);               // Mise en route  mode auto
  pinMode(InterSTOP, INPUT);                // Mise à l'arret mode auto  
  pinMode(potmot, INPUT);                   // Signal entree carte pour reglage de la vitesse
  pinMode(potdir, INPUT);                   // Signal entree carte pour reglage de la direction   
// Broche de sortie
  pinMode(SortieMoteur, OUTPUT);            // Signal sortie carte vers ESC
  pinMode(SortieDirection, OUTPUT);         // Signal sortie carte vers Servo de direction 
  
// Initialisation des sorties
  digitalWrite(SortieMoteur, LOW);   
  digitalWrite(SortieDirection, LOW);
  
// Moteur
  Moteur.attach(10);
  Serial.begin(9600);
// Direction
  Direction.attach(2);
  Serial.begin(9600);

}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Programme
void loop() 
{
   etatInterMANU = digitalRead(InterMANU);
   etatInterAUTO = digitalRead(InterAUTO);
   etatInterSTART = digitalRead(InterSTART);
   etatInterSTOP = digitalRead(InterSTOP);
   Serial.print("etatInterMANU");
   Serial.print(etatInterMANU);
   Serial.print("etatInterAUTO");
   Serial.print(etatInterAUTO);
   Serial.print("etatInterSTART");
   Serial.print(etatInterSTART);
   Serial.print("etatInterSTOP");
   Serial.print(etatInterSTOP);
   
// ------------------- Utilisation du mode MANUEL avec les deux potentiomètre -------------------------------------------------------------------------------------------

if (( etatInterMANU == HIGH) && (etatInterAUTO == LOW) && (((etatInterSTART == HIGH) && (etatInterSTOP == LOW)) || ((etatInterSTART == LOW) && (etatInterSTOP == HIGH))))
{
  // Moteur
  Moteur.attach(10);
  Serial.begin(9600);
  // Direction
  Direction.attach(2);
  Serial.begin(9600);  
  do {  
    // Prog moteur
    valpotmot = analogRead(potmot);
    Serial.print("valpotmot:");
    Serial.print(valpotmot);
    SortieMoteur = map(valpotmot, 0, 1023, 0, 179);
    Serial.print(", SortieMoteur: ");
    Serial.println(SortieMoteur);
    Moteur.write(SortieMoteur);
    //Prog direction
    valpotdir = analogRead(potdir);
    Serial.print("valpotdir:");
    Serial.print(valpotdir);
    SortieDirection = map(valpotdir, 0, 1023, 0, 179);
    Serial.print(", SortieDirection: ");
    Serial.println(SortieDirection);
    Direction.write(SortieDirection);
   }
   while (InterAUTO == HIGH);
}
// ------------------- Utilisation du mode AUTO avec boucle de variation -------------------------------------------------------------------------------------------------
     
else if (( etatInterMANU == LOW) && (etatInterAUTO == HIGH) && (((etatInterSTART == HIGH) && (etatInterSTOP == LOW))))
{     
  // Moteur
  Moteur.attach(10);
  Serial.begin(9600);
  // Direction
  Direction.attach(2);
  Serial.begin(9600);     
  do {
     // Prog moteur
     valmotauto = 20;
     SortieMoteur = map(valmotauto, 0, 1023, 0, 179);
     Moteur.write(SortieMoteur);
     delay(10000);
     //Prog direction
     valdirauto = 500;
     SortieDirection = map(valdirauto, 0, 1023, 0, 179);
     Direction.write(SortieDirection);
     delay(10000);
     valmotauto = 250;
     SortieMoteur = map(valmotauto, 0, 1023, 0, 179);
     Moteur.write(SortieMoteur);
     delay(10000);
     //Prog direction
     valdirauto = 50;
     SortieDirection = map(valdirauto, 0, 1023, 0, 179);
     Direction.write(SortieDirection);
     delay(10000);
     valmotauto = 800;
     SortieMoteur = map(valmotauto, 0, 1023, 0, 179);
     Moteur.write(SortieMoteur);
     delay(10000);
     //Prog direction
     valdirauto = 120;
     SortieDirection = map(valdirauto, 0, 1023, 0, 179);
     Direction.write(SortieDirection);
     delay(10000);
     } 
     while (InterSTOP == HIGH);
}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------

// ------------------- Utilisation du mode AUTO version OFF --------------------------------------------------------------------------------------------------------------
     
else (( etatInterMANU == LOW) && (etatInterAUTO == HIGH) && (((etatInterSTART == LOW) && (etatInterSTOP == HIGH))));
{     
  // Moteur
  Moteur.attach(10);
  Serial.begin(9600);
  // Direction
  Direction.attach(2);
  Serial.begin(9600); 
  do {
     digitalWrite(SortieMoteur, LOW);   
     digitalWrite(SortieDirection, LOW);   
     } 
     while (InterSTART == HIGH);
}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
}

Voilà si quelqu'un a une solution ???

hello

je voyais plutôt un truc comme ça

const byte InterMANU = 8;              // Choix mode manuel
const byte InterAUTO = 7;              // Choix mode automatique
const byte InterSTART = 6;             // Mise en route mode auto
void setup() {
  Serial.begin(9600);
}

void loop()
{
  if (digitalRead(InterSTART))
  {
    if (digitalRead(InterMANU))
    {
    Serial.println("mode MANU");
    //code pour MANU
    }
    if (digitalRead(InterAUTO))
    {
    Serial.println("mode AUTO");
    //code pour AUTO
    }
  }
}

Bonjour,

J'ai pas eu trop le temps cette semaine mais j'ai essayé et ça ne marche toujours pas.
Quand je teste mes programme manu et auto de manière indépendante ça marche mais des que j'essai d'intégrer les interrupteurs c'est fini. J'ai un problème avec les if.

C'st le programme le plus logique ar rapport à ce que je veux faire mais rien à faire ça ne marche pas, j'ai vérifier tout les câblages et même avec une autre carte mais c'est pareil

// Programme banc de test
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Nom des entrées / sorties
// Interrupteur choix du mode
const byte InterMANU = 8;                 // Choix mode manuel
const byte InterAUTO = 7;                 // Choix mode automatique
// Interrupteur mode auto
const byte InterSTART = 6;                // Mise en route mode auto
const byte InterSTOP = 5;                 // Mise à l'arret mode auto
// Moteur 
#include <Servo.h>
Servo Moteur;
int SortieMoteur = 3;                    // Signal sortie carte vers ESC
int const potmot = A0;                   // Signal entree carte pour reglage de la vitesse
int valpotmot;
// Direction
#include <Servo.h>
Servo Direction;
int SortieDirection = 2;                 // Signal sortie carte vers Servo de direction
int const potdir = A3;                   // Signal entree carte pour reglage de la direction
int valpotdir;
// Mode AUTO
int valmotauto;                           // Valeur auto moteur
int valdirauto;                           // Valeur auto direction
// Variable etat interrupteur
byte etatInterMANU;
byte etatInterAUTO;
byte etatInterSTART;
byte etatInterSTOP;

// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Définition des entrées / sorties
void setup()
{
 
// Broche d'entree
  pinMode(InterMANU, INPUT);                // Interrupteur position mode manuel
  pinMode(InterAUTO, INPUT);                // Interrupteur position mode automatique
  pinMode(InterSTART, INPUT);               // Mise en route  mode auto
  pinMode(InterSTOP, INPUT);                // Mise à l'arret mode auto  
  pinMode(potmot, INPUT);                   // Signal entree carte pour reglage de la vitesse
  pinMode(potdir, INPUT);                   // Signal entree carte pour reglage de la direction   
// Broche de sortie
  pinMode(SortieMoteur, OUTPUT);            // Signal sortie carte vers ESC
  pinMode(SortieDirection, OUTPUT);         // Signal sortie carte vers Servo de direction 
  
// Moteur
  Moteur.attach(3);
  Serial.begin(9600);
// Direction
  Direction.attach(2);
  Serial.begin(9600);

}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Programme
void loop() 
{
   etatInterMANU = digitalRead(InterMANU);
   etatInterAUTO = digitalRead(InterAUTO);
   etatInterSTART = digitalRead(InterSTART);
   etatInterSTOP = digitalRead(InterSTOP);
   Serial.print("etatInterMANU");
   Serial.print(etatInterMANU);
   Serial.print("etatInterAUTO");
   Serial.print(etatInterAUTO);
   Serial.print("etatInterSTART");
   Serial.print(etatInterSTART);
   Serial.print("etatInterSTOP");
   Serial.print(etatInterSTOP);
   
// ------------------- Utilisation du mode MANUEL avec les deux potentiomètre -------------------------------------------------------------------------------------------

if (( etatInterMANU == HIGH) && (etatInterAUTO == LOW) && (((etatInterSTART == (HIGH || LOW)) || (etatInterSTOP == (HIGH || LOW)))  ))
{
  // Moteur
  Moteur.attach(3);
  Serial.begin(9600);
  // Direction
  Direction.attach(2);
  Serial.begin(9600);  
  do {  
    // Prog moteur
    valpotmot = analogRead(potmot);
    Serial.print("valpotmot:");
    Serial.print(valpotmot);
    SortieMoteur = map(valpotmot, 0, 1023, 0, 179);
    Serial.print(", SortieMoteur: ");
    Serial.println(SortieMoteur);
    Moteur.write(SortieMoteur);
    //Prog direction
    valpotdir = analogRead(potdir);
    Serial.print("valpotdir:");
    Serial.print(valpotdir);
    SortieDirection = map(valpotdir, 0, 1023, 0, 179);
    Serial.print(", SortieDirection: ");
    Serial.println(SortieDirection);
    Direction.write(SortieDirection);
   }
   while (InterMANU == LOW);
}
// ------------------- Utilisation du mode AUTO avec boucle de variation -------------------------------------------------------------------------------------------------
     
else if (( etatInterMANU == LOW) && (etatInterAUTO == HIGH) && (etatInterSTART == HIGH) )
{     
  // Moteur
  Moteur.attach(3);
  Serial.begin(9600);
  // Direction
  Direction.attach(2);
  Serial.begin(9600);     
  do {
     // Prog moteur
     valmotauto = 20;
     SortieMoteur = map(valmotauto, 0, 1023, 0, 179);
     Moteur.write(SortieMoteur);
     delay(10000);
     //Prog direction
     valdirauto = 500;
     SortieDirection = map(valdirauto, 0, 1023, 0, 179);
     Direction.write(SortieDirection);
     delay(10000);
     valmotauto = 250;
     SortieMoteur = map(valmotauto, 0, 1023, 0, 179);
     Moteur.write(SortieMoteur);
     delay(10000);
     //Prog direction
     valdirauto = 50;
     SortieDirection = map(valdirauto, 0, 1023, 0, 179);
     Direction.write(SortieDirection);
     delay(10000);
     valmotauto = 800;
     SortieMoteur = map(valmotauto, 0, 1023, 0, 179);
     Moteur.write(SortieMoteur);
     delay(10000);
     //Prog direction
     valdirauto = 120;
     SortieDirection = map(valdirauto, 0, 1023, 0, 179);
     Direction.write(SortieDirection);
     delay(10000);
     } 
     while (InterSTART == LOW);
}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------

// ------------------- Utilisation du mode AUTO version OFF --------------------------------------------------------------------------------------------------------------
     
else (( etatInterMANU == LOW) && (etatInterAUTO == HIGH) && (((etatInterSTART == LOW) && (etatInterSTOP == HIGH))));
{     
  // Moteur
  Moteur.attach(3);
  Serial.begin(9600);
  // Direction
  Direction.attach(2);
  Serial.begin(9600); 
  do {
     digitalWrite(SortieMoteur, LOW);   
     digitalWrite(SortieDirection, LOW);   
     } 
     while (InterSTOP == LOW);
}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
}

Voilà si quelques à une solutions parceque la je bloque complètement

Merci par avance
Philippe

hello
testes ce code que je ne peux tester

// Programme banc de test
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Nom des entrées / sorties
// Interrupteur choix du mode
const byte InterMANU = 8;                 // Choix mode manuel
const byte InterAUTO = 7;                 // Choix mode automatique
// Interrupteur mode auto
const byte InterSTART = 6;                // Mise en route mode auto
const byte InterSTOP = 5;                 // Mise à l'arret mode auto
// Moteur
#include <Servo.h>
Servo Moteur;
//int SortieMoteur = 3;                    // Signal sortie carte vers ESC
int const potmot = A0;                   // Signal entree carte pour reglage de la vitesse
int valpotmot;
// Direction
#include <Servo.h>
Servo Direction;
//int SortieDirection = 2;                 // Signal sortie carte vers Servo de direction
int const potdir = A3;                   // Signal entree carte pour reglage de la direction
int valpotdir;
// Mode AUTO
int valmotauto;                           // Valeur auto moteur
int valdirauto;                           // Valeur auto direction
// Variable etat interrupteur
byte etatInterMANU;
byte etatInterAUTO;
byte etatInterSTART;
byte etatInterSTOP;

// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Définition des entrées / sorties
void setup()
{
  Serial.begin(9600);
  // Broche d'entree
  pinMode(InterMANU, INPUT);                // Interrupteur position mode manuel
  pinMode(InterAUTO, INPUT);                // Interrupteur position mode automatique
  pinMode(InterSTART, INPUT);               // Mise en route  mode auto
  pinMode(InterSTOP, INPUT);                // Mise à l'arret mode auto
  pinMode(potmot, INPUT);                   // Signal entree carte pour reglage de la vitesse
  pinMode(potdir, INPUT);                   // Signal entree carte pour reglage de la direction



  // Moteur
  Moteur.attach(3);

  // Direction
  Direction.attach(2);


}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Programme
void loop()
{
  etatInterMANU = digitalRead(InterMANU);
  etatInterAUTO = digitalRead(InterAUTO);
  etatInterSTART = digitalRead(InterSTART);
  etatInterSTOP = digitalRead(InterSTOP);
  Serial.print("etatInterMANU");
  Serial.print(etatInterMANU);
  Serial.print("etatInterAUTO");
  Serial.print(etatInterAUTO);
  Serial.print("etatInterSTART");
  Serial.print(etatInterSTART);
  Serial.print("etatInterSTOP");
  Serial.print(etatInterSTOP);

  // ------------------- Utilisation du mode MANUEL avec les deux potentiomètre -------------------------------------------------------------------------------------------

  if (( etatInterMANU == HIGH) && (etatInterAUTO == LOW) && (((etatInterSTART == (HIGH || LOW)) || (etatInterSTOP == (HIGH || LOW)))  ))
  {


    do {
      // Prog moteur
      valpotmot = analogRead(potmot);
      Serial.print("valpotmot:");
      Serial.print(valpotmot);
      valpotmot = map(valpotmot, 0, 1023, 0, 179);
      Serial.print(", SortieMoteur: ");
      Serial.println(valpotmot);
      Moteur.write(valpotmot);
      //Prog direction
      valpotdir = analogRead(potdir);
      Serial.print("valpotdir:");
      Serial.print(valpotdir);
      valpotdir = map(valpotdir, 0, 1023, 0, 179);
      Serial.print(", SortieDirection: ");
      Serial.println(valpotdir);
      Direction.write(valpotdir);
    }
    while (InterMANU == LOW);
  }
  // ------------------- Utilisation du mode AUTO avec boucle de variation -------------------------------------------------------------------------------------------------

  else if (( etatInterMANU == LOW) && (etatInterAUTO == HIGH) && (etatInterSTART == HIGH) )
  {

    do {
      // Prog moteur
      valmotauto = 20;
      valmotauto = map(valmotauto, 0, 1023, 0, 179);
      Moteur.write(valmotauto);
      delay(10000);
      //Prog direction
      valdirauto = 500;
      valdirauto = map(valdirauto, 0, 1023, 0, 179);
      Direction.write(valdirauto);
      delay(10000);
      valmotauto = 250;
      valmotauto = map(valmotauto, 0, 1023, 0, 179);
      Moteur.write(valmotauto);
      delay(10000);
      //Prog direction
      valdirauto = 50;
      valdirauto = map(valdirauto, 0, 1023, 0, 179);
      Direction.write(valdirauto);
      delay(10000);
      valmotauto = 800;
      valmotauto = map(valmotauto, 0, 1023, 0, 179);
      Moteur.write(valmotauto);
      delay(10000);
      //Prog direction
      valdirauto = 120;
      valdirauto = map(valdirauto, 0, 1023, 0, 179);
      Direction.write(valdirauto);
      delay(10000);
    }
    while (InterSTART == LOW);
  }
  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------

  // ------------------- Utilisation du mode AUTO version OFF --------------------------------------------------------------------------------------------------------------

  else (( etatInterMANU == LOW) && (etatInterAUTO == HIGH) && (((etatInterSTART == LOW) && (etatInterSTOP == HIGH))));
  {

    do {
      Moteur.write(LOW);
      Direction.write(LOW);
    }
    while (InterSTOP == LOW);
  }
  // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
}

Toujours pas

Toujours pas

hello

mais encore ?

Bon ça marche, je sais pas vraiment pourquoi mais à force de faire des essais ...

// Programme banc de test
// ------------------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------------------------
// Nom des entrées / sorties
// Interrupteur choix du mode
const byte InterMANU = 8;                 // Choix mode manuel
const byte InterAUTO = 7;                 // Choix mode automatique
// Interrupteur mode auto
const byte InterSTART = 6;                // Mise en route mode auto
const byte InterSTOP = 5;                 // Mise à l'arret mode auto
// Moteur 
#include <Servo.h>
Servo Moteur;
int SortieMoteur = 3;                    // Signal sortie carte vers ESC
int const potmot = A0;                   // Signal entree carte pour reglage de la vitesse
int valpotmot;
// Direction
#include <Servo.h>
Servo Direction;
int SortieDirection = 2;                 // Signal sortie carte vers Servo de direction
int const potdir = A3;                   // Signal entree carte pour reglage de la direction
int valpotdir;
// Mode AUTO
int valmotauto;                           // Valeur auto moteur
int valdirauto;                           // Valeur auto direction
// Variable etat interrupteur
byte etatInterMANU;
byte etatInterAUTO;
byte etatInterSTART;
byte etatInterSTOP;

// -----------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------
// Définition des entrées / sorties
void setup()
{
 
// Broche d'entree
  pinMode(InterMANU, INPUT);                // Interrupteur position mode manuel
  pinMode(InterAUTO, INPUT);                // Interrupteur position mode automatique
  pinMode(InterSTART, INPUT);               // Mise en route  mode auto
  pinMode(InterSTOP, INPUT);                // Mise à l'arret mode auto  
  pinMode(potmot, INPUT);                   // Signal entree carte pour reglage de la vitesse
  pinMode(potdir, INPUT);                   // Signal entree carte pour reglage de la direction   
// Broche de sortie
  pinMode(SortieMoteur, OUTPUT);            // Signal sortie carte vers ESC
  pinMode(SortieDirection, OUTPUT);         // Signal sortie carte vers Servo de direction 
  
// Moteur
  Moteur.attach(3);
// Direction
  Direction.attach(2);
  
  Serial.begin(9600);

}
// -------------------------------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------------------
// Programme
void loop() 
{
   etatInterMANU = digitalRead(InterMANU);
   etatInterAUTO = digitalRead(InterAUTO);
   etatInterSTART = digitalRead(InterSTART);
   etatInterSTOP = digitalRead(InterSTOP);

   
// ------------------- Utilisation du mode MANUEL avec les deux potentiomètre ----------------------------------------------------------

if (( etatInterMANU == HIGH) && (etatInterAUTO == LOW) && (((etatInterSTART == (HIGH || LOW)) || (etatInterSTOP == (HIGH || LOW)))  ))
{
  do {  
    // Prog moteur
    valpotmot = analogRead(potmot);
    Serial.print("valpotmot:");
    Serial.print(valpotmot);
    SortieMoteur = map(valpotmot, 0, 500, 0, 100);
    Serial.print(", SortieMoteur: ");
    Serial.println(SortieMoteur);
    Moteur.write(SortieMoteur);
    //Prog direction
    valpotdir = analogRead(potdir);
    Serial.print("valpotdir:");
    Serial.print(valpotdir);
    SortieDirection = map(valpotdir, 0, 500, 0, 100);
    Serial.print(", SortieDirection: ");
    Serial.println(SortieDirection);
    Direction.write(SortieDirection);
   } while ((InterMANU == LOW) || ((InterAUTO == HIGH) && (InterSTOP == HIGH)));

}
   
// ------------------- Utilisation du mode AUTO avec boucle de variation ---------------------------------------------------------------
     
if ((etatInterMANU == LOW) && (etatInterAUTO == HIGH) && (etatInterSTART == HIGH) && (etatInterSTOP == LOW))
{     
  do {
// ------------------- Début de séquence de programmation auto -------------------------------------------------------------------------                            
     // Prog moteur
     valmotauto = 500;
     SortieMoteur = map(valmotauto, 0, 1000, 0, 100);
     Moteur.write(SortieMoteur);
     delay(3000);
     //Prog direction
     valdirauto = 500;
     SortieDirection = map(valdirauto, 0, 1000, 0, 100);
     Direction.write(SortieDirection);
     delay(3000);
     
     // Prog moteur
     valmotauto = 350;
     SortieMoteur = map(valmotauto, 0, 1000, 0, 100);
     Moteur.write(SortieMoteur);
     delay(3000);
     //Prog direction
     valdirauto = 150;
     SortieDirection = map(valdirauto, 0, 1000, 0, 100);
     Direction.write(SortieDirection);
     delay(3000);
     
     // Prog moteur
     valmotauto = 500;
     SortieMoteur = map(valmotauto, 0, 1000, 0, 100);
     Moteur.write(SortieMoteur);
     delay(3000);
     //Prog direction
     valdirauto = 500;
     SortieDirection = map(valdirauto, 0, 1000, 0, 100);
     Direction.write(SortieDirection);
     delay(3000);
     
     // Prog moteur
     valmotauto = 650;
     SortieMoteur = map(valmotauto, 0, 1000, 0, 100);
     Moteur.write(SortieMoteur);
     delay(3000);
     //Prog direction
     valdirauto = 850;
     SortieDirection = map(valdirauto, 0, 1000, 0, 100);
     Direction.write(SortieDirection);
     delay(3000);
// ------------------- Fin de séquence de programmation auto -----------------------------------------------------------------------
       }while ((InterSTOP == HIGH) || (InterAUTO == LOW) || (InterMANU == HIGH));

}

// ---------------------------------------------------------------------------------------------------------------------------------

// ------------------- Utilisation du mode AUTO version OFF ------------------------------------------------------------------------
     
if ((etatInterMANU == (HIGH || LOW)) && (etatInterAUTO == (HIGH || LOW)) && (((etatInterSTART == LOW) && (etatInterSTOP == HIGH))));
{     
  do {
     digitalWrite(SortieMoteur, LOW);   
     digitalWrite(SortieDirection, LOW);   
     }while ((InterMANU == HIGH) || (InterAUTO == HIGH)) ;
     }

if ((etatInterMANU == LOW) && (etatInterAUTO == LOW) && (((etatInterSTART == (HIGH || LOW))) && (etatInterSTOP == (HIGH || LOW))));
{     
  do {
     digitalWrite(SortieMoteur, LOW);   
     digitalWrite(SortieDirection, LOW);   
     }while ((InterMANU == HIGH) || (InterAUTO == HIGH));
     }
// ---------------------------------------------------------------------------------------------------------------------------------
}

Il reste plus qu'à affiner la séquence du mode auto pour pouvoir avoir des courbes plus linéaires niveau accélération

Bonjour,

Maintenant que ça marche, je souhaiterais modifier une partie du programme

// ------------------- Utilisation du mode AUTO avec boucle de variation ---------------------------------------------------------------
     
if ((etatInterMANU == LOW) && (etatInterAUTO == HIGH) && (etatInterSTART == HIGH) && (etatInterSTOP == LOW))
{     
  do {
// ------------------- Début de séquence de programmation auto -------------------------------------------------------------------------                            
     // Prog moteur
     valmotauto = 500;
     SortieMoteur = map(valmotauto, 0, 1000, 0, 100);
     Moteur.write(SortieMoteur);
     delay(3000);
     //Prog direction
     valdirauto = 500;
     SortieDirection = map(valdirauto, 0, 1000, 0, 100);
     Direction.write(SortieDirection);
     delay(3000);
     
     // Prog moteur
     valmotauto = 350;
     SortieMoteur = map(valmotauto, 0, 1000, 0, 100);
     Moteur.write(SortieMoteur);
     delay(3000);
     //Prog direction
     valdirauto = 150;
     SortieDirection = map(valdirauto, 0, 1000, 0, 100);
     Direction.write(SortieDirection);
     delay(3000);
     
     // Prog moteur
     valmotauto = 500;
     SortieMoteur = map(valmotauto, 0, 1000, 0, 100);
     Moteur.write(SortieMoteur);
     delay(3000);
     //Prog direction
     valdirauto = 500;
     SortieDirection = map(valdirauto, 0, 1000, 0, 100);
     Direction.write(SortieDirection);
     delay(3000);
     
     // Prog moteur
     valmotauto = 650;
     SortieMoteur = map(valmotauto, 0, 1000, 0, 100);
     Moteur.write(SortieMoteur);
     delay(3000);
     //Prog direction
     valdirauto = 850;
     SortieDirection = map(valdirauto, 0, 1000, 0, 100);
     Direction.write(SortieDirection);
     delay(3000);
// ------------------- Fin de séquence de programmation auto -----------------------------------------------------------------------
       }while ((InterSTOP == HIGH) || (InterAUTO == LOW) || (InterMANU == HIGH));

}

Je souhaiterais garder une seule ligne de programme

// ------------------- Utilisation du mode AUTO avec boucle de variation ---------------------------------------------------------------
     
if ((etatInterMANU == LOW) && (etatInterAUTO == HIGH) && (etatInterSTART == HIGH) && (etatInterSTOP == LOW))
{     
  do {
     
     // Prog moteur
     valmotauto = 650;
     SortieMoteur = map(valmotauto, 0, 1000, 0, 100);
     Moteur.write(SortieMoteur);
     delay(3000);
     //Prog direction
     valdirauto = 850;
     SortieDirection = map(valdirauto, 0, 1000, 0, 100);
     Direction.write(SortieDirection);
     delay(3000);
// ------------------- Fin de séquence de programmation auto -----------------------------------------------------------------------
       }while ((InterSTOP == HIGH) || (InterAUTO == LOW) || (InterMANU == HIGH));

}

en y intégrant une sorte de tableau que je pourrais faire sur excel (plus facile peut être avant de l'importer dans le programme).

Y aurait il un fonction à utiliser en particulier ? Pour faire un lise de variable qui pourrait être lues dans le programmes?