I am using a driver board that is set up to control my stepper motor via a Step and Direction pin. I wanted to try out the stepper motor knob tutorial () but it uses 4 pins to control the stepper motor. Is there a stepper motor knob tutorial out there for the 2 pin (dir/step) setup?
Just use 2 pins in the setup not 4 .
Don't remember which is which but it's just a simple test to see so I will leave that to you.
justone:
Just use 2 pins in the setup not 4 .Don't remember which is which but it's just a simple test to see so I will leave that to you.
Really? It's that simple? Thanks.
I am using a driver board that is set up to control my stepper motor via a Step and Direction pin.
Using what code?
PaulS:
I am using a driver board that is set up to control my stepper motor via a Step and Direction pin.
Using what code?
/*
* 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;
}
I don't think it's working right. It seems to be going back and forth 90º then turning to a different 90º section and going back and forth between that 90º. Also the pot doesnt have any effect, I am doing to try a different one. The one I hooked up has 6 pins, I have another with the standard 3.
Using the other pot I seems to have given me some control over it, I can move it back and forth by turning the pot so I guess it's working. It doesn't seem quite right though.
Check my code tell me if there's anything you see in there that is suspicious.
If that's the code you are using then it looks like you are still not in dir /step mode of the stepper driver.
All you need is :
Stepper stepper (STEPS,8,9); dir/step
justone:
If that's the code you are using then it looks like you are still not in dir /step mode of the stepper driver.All you need is :
Stepper stepper (STEPS,8,9); dir/step
error: expected constructor, destructor, or type conversion before '/' token
duncan916:
justone:
If that's the code you are using then it looks like you are still not in dir /step mode of the stepper driver.All you need is :
Stepper stepper (STEPS,8,9); dir/steperror: expected constructor, destructor, or type conversion before '/' token
Stepper stepper (STEPS,8,9); // dir/step (this was a comment referring to pins 8 and 9)