Microstep Driver DQ420MA changing directions code.

Need some codes for Microstep Driver DQ420MA, to change it direction from counter clockwise to clockwise. Response is much appreciated.

You might want to change the level of the DIR signal.

zwieblum:
You might want to change the level of the DIR signal.

I change it but it does not work, it only works when the dirPin is on “HIGH” this is my code btw.

const int stepPin = 2;
const int dirPin = 3;
int ReceivedStepper = 0;

float stepPerAngle = 1.8;

void setup() {

Serial.begin(9600);

// set the two pins as outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);

}

void loop(){
if(Serial.available()>0)
{

ReceivedStepper = Serial.read();
char Rec = char(ReceivedStepper);
}
{
if (ReceivedStepper == ‘1’)
{
digitalWrite(dirPin,HIGH); //Enables the motor to move in a perticular direction
for(int x = 0; x < 50; x++){
//50 to turn 90 degrees
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);

}

ReceivedStepper = 0;
}
if (ReceivedStepper == ‘2’){
digitalWrite(dirPin,LOW); //Enables the motor to move in a perticular direction
for(int x = 0; x < 50; x++){
/////50 and HIGH to turn 90 degrees in backwards
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}

ReceivedStepper = 0;
}
}}

sabinoooo:
Need some codes for Microstep Driver DQ420MA, to change it direction from counter clockwise to clockwise. Response is much appreciated.

Please post a link to the datasheet for the driver and also make a simple pencil drawing showing how YOU have everything connected and post a photo of the drawing. See this Simple Image Guide

...R
Stepper Motor Basics
Simple Stepper Code

Minimum voltage for that driver is 18V. What is your power supply voltage?

JCA79B:
Minimum voltage for that driver is 18V. What is your power supply voltage?
https://openbuildspartstore.com/content/DQ542MA%20English%20Manual.pdf

This is for the DQ542MA, I am using DQ420MA and its minimum power supply voltage is 12V.

Thank you for all your help, I just forgot to connect the enable pin and change the condition.