hello, me again
i have a stepper motor 28byj-48 5vdc and the driver chip uln2003an(this is in a board).
i try with this and a 5k potentiometer to control the motor but it turns only one direction!
The fault is in the code you did not post.
Mark
the code is from arduino program i dont change anything
/*
- MotorKnob
- A stepper motor follows the turns of a potentiometer
- (or other sensor) on analog input 0.
- http://www.arduino.cc/en/Reference/Stepper
- This example code is in the public domain.
*/#include <Stepper.h>
// change this to the number of steps on your motor
#define STEPS 100// 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 30 RPMs
stepper.setSpeed(30);
}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;
}
Why do you think that that code will do anything but turn the stepper in one direction?
Mark
but why the motor turns only one direction
Because that's what the code tells it to do!
Mark
how i fix it?
(sorry but im a bad programmer)
xitosman:
how i fix it?
(sorry but im a bad programmer)
Have you taken a look at the reference for the steppers?
http://arduino.cc/en/reference/stepper
In particular, look at the step(int) method and see what it says about direction.