Hello,
Need some help with a project using a stepper motor 28byj-48 ( 5 VDC ), uln2003 controller and a potentiometer.
I only need to control the stepper motor using a potentiometer ( in this case 10Kohm), turning the knob the motor starts, stop turning the knob, the stepper stops, reverse the knob the stepper also reverse, but the stepper only vibrates. All connections ok. Potentiometer connected to A0. Already check the analog values of the potentiometer, using the serial monitor, and it's ok.
There are something wrong in the code, for sure. Can someone give me a hand, please??
Sorry my english!!!
#include <Stepper.h>
#define STEPS 64
Stepper stepper(STEPS, 8, 9, 10, 11);
int previous = 0;
void setup()
{
stepper.setSpeed(200);
}
void loop()
{
int val = map(analogRead(0), 0, 1023, 64 , 0);
stepper.step(val - previous);
previous = val;
}
Thanks