Oui , vous avez trouvé . Chapeau. Le détail en image ci dessous .
Mais ! il a fallu que je supprime stepper.stop(); .
Je suppose que lui aussi à un besoin précis mais je sais pas lequel . J'ai bien essayé pour briller un peu
#include <AccelStepper.h> AccelStepper stepper (1, 9, 8); const int PinBoutonInit = A0; //Bouton qui déplacera le chariot vers la buté à 30 cm const int PinContactButé = A1;// Contact qui stope le chariot à 30 cm void initMoteur () { if (digitalRead(PinBoutonInit) == 0) { Serial.println (" Initialisation en cours " ); while (digitalRead(PinContactButé) == 1) { stepper.runSpeed(); // on attends la buté } //stepper.stop(); Serial.println ("Initialisation terminée " ); } } void setup() { Serial.begin(9600); pinMode(A0, INPUT_PULLUP); // pour le mettre en INPUT_PULLUP pinMode(A1, INPUT_PULLUP); // pour le mettre en INPUT_PULLUP stepper.setMaxSpeed(4000); stepper.setSpeed(3900); } void loop() { initMoteur (); }