With the attached hardware configuration and code as an example, what would be a reasonable estimate of the time to make a 50 step move?
code.txt (680 Bytes)
With the attached hardware configuration and code as an example, what would be a reasonable estimate of the time to make a 50 step move?
code.txt (680 Bytes)
For short programs it is much easier for us if you include the code in your post using the code button </> so it is like this
#include <Stepper.h>
// change this to the number of steps on your motor
#define STEPS 200
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 9, 10, 11);
// the previous reading from the analog input
int previous = 0;
void setup()
{
// set the speed of the motor to 500 RPMs
stepper.setSpeed(500);
}
void loop()
{
// get the sensor value
int val = analogRead(0);
// move a number of steps equal to the change in the
// sensor reading
stepper.step(val - previous);
// remember the previous value of the sensor
previous = val;
}
With a speed of 500 RPM or 8.333 revs per second the interval between steps will be 120 millisecs (if my maths is correct).
I will leave it to you to calculate the time for 50 steps.
...R