Hello,
i just started to learn how to use an arduino and I want to control the speed of a stepper motor with a potentiometer and then display the speed on a display. I have a stepper motor, that has 100 steps per revolution. I´m using a 10k potentiometer and a 20*4 display. The driver I use is a simple polulu driver
So far, I can control the speed of the stepper but I don´t no how I can determine the speed of the stepper.
My code is in the attachment. I didn´t use the dir pin because i want the stepper to move in only one way. As you can see, the potentiometer is in the delay(). And I thought that, if i can count the number of revolution of the motor, i could then calculate the speed.
Calculation:
when the step pin is High for a certain time t and Low for the same certain time t (as in the code), so it means that the stepper has 1 revolution in 2*t s (is it right?). I want that the value of the speed changes in function of the value of the potentiometer, given that the potentiometer controls the speed. But I don´t know how the code could like. Can somebody please help me?
sorry, my english is not so good.
Thank you in advance
sketch_mar06a_test_poti_stepper.ino (1.06 KB)