0

I want to de-energize the stepper motor from the +ENA & -ENA pins on the stepper driver. I wanted to know what is the correct way to do this? I'm hooking up the two enable pins with 2 digital pins of the microcontroller.

I tried using the code below but the stepper seemed to work for every case. Where am I going wrong?

#include "mbed.h"

#include "stepperMotor.h"

Serial pc(USBTX,USBRX);

sMotor Radial_Stepper(PA_3, PC_0, PC_3, PF_3);   // 24V NEMA23
DigitalOut Radial_Stepper_Enable(PE_8);          // To enable Radial Stepper
DigitalOut Radial_Stepper_Disable(PG_1);

int main()
{
    int ch;

    while (true) 
    {
        pc.printf("\nChoice: ");
        pc.scanf("%d",&ch);

        switch(ch)
    {
        case 1: Radial_Stepper_Enable = 1;
                Radial_Stepper.step(200,0,400); 
                Radial_Stepper_Disable = 1;
        break;

        case 2: Radial_Stepper_Enable = 0;
                Radial_Stepper.step(200,0,400); 
                Radial_Stepper_Disable = 1;
        break;

        case 3: Radial_Stepper_Disable = 1;
                Radial_Stepper.step(200,0,400);
                Radial_Stepper_Enable = 0;
        break;
    }
    }
}

I expected that the stepper wouldn't have rotated in case 2 and 3 because the Radial Stepper wasn't enabled.

1 Answers1

0

Run your stepper motor driver separately to test if these Enable pins work as intended. Then make changes in the program accordingly.