7 Replies Latest reply on Mar 3, 2016 2:01 PM by Intel_Alvarado

    Stepper motor control with intel edison kit for arduino

    Guimficus

      Hello everybody,

      I'm a beginner in the use of intel edison platform. I've a problem in control a step motor with the arduino board intel edison. I've an arduino motor shield which is supposed to help me to control a stepper motor. But when I upload the following program, the moteur does not work. Can't anyone have a solution for me please? This is my program: 

       

      #include <Stepper.h>

      //Define output

      #define enA         3               // Enable (PWM)A on Motor Control Shield  

      #define enB         11              // Enable (PWM)B on Motor Control Shield 

      #define dirA        12              // Direction pin dirA on Motor Control Shield

      #define dirB        13              // Direction pin dirB on Motor Control Shield

       

      const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution

      // for your motor

       

      // initialize the stepper library on pins 8 through 11:

      Stepper myStepper(stepsPerRevolution, dirA, dirB);

       

      void setup() {

        //Initialisation des sorties

      pinMode(enA,               OUTPUT);

      pinMode(enB,               OUTPUT);

       

      //Définition de l'état initial (Stepper)

      digitalWrite (enA,          HIGH);

      digitalWrite (enB,          HIGH);

       

        // set the speed at 60 rpm:

        myStepper.setSpeed(60);

        // initialize the serial port:

        Serial.begin(9600);

      }

       

      void loop() {

        // step one revolution  in one direction:

        Serial.println("clockwise");

        myStepper.step(stepsPerRevolution);

        delay(500);

       

        // step one revolution in the other direction:

        Serial.println("counterclockwise");

        myStepper.step(-stepsPerRevolution);

        delay(500);

      }