@sharmashivani20
I have moved your thread to a relevant section. Installation and Troubleshooting is NOT for your projects as it says in the section’s description.
when it execute, motor moves fast with pulse delay is 250 in this case it is fixed pd value 250. So I want pd 300 so that motor moves slowly. I want variable value of pd 300,400 likewise. From serial suppose I'm sending 300 then rotate motor.
So why don’t you change the value of pd?
By the way the bigger the value of pd is the slower it moves, the smaller it is the faster it moves.
You set it here
int pd = 500; // Pulse Delay period
If you want to make it a variable then you have to change something that changes the value of pd, like in response to the reading of a pot on an analogue input pin.
Then change the map function so you get those values.
Note that the reading of the analogue port takes 0.1 mS, which significantly adds to the 300uS you want to add.
Hello,
i used in a programm this code. I'am German, so the comments are German. If you need, i can translate.
FahreLinks = move left
Verz = Verzögerung = delay
Rampe = ramp (simple version)
AnzahlSchritte = number of steps
The pd you mean is Verz in my code.
The motor moves at the beginning slowlier due to the variable Rampe. The delay from Rampe gos down with increasing the steps in the for-loop.