So I just picked up an Arduino Duemilanove a couple days ago. I am brand new to microcontrollers. I ran the blinking led example, which worked fine. Then I tried to run the MotorKnob example, in which you can control a stepper with a potentiometer. I am driving the stepper w/ a sn75441one, but I couldn't get it to work properly. The motor would either seize up, or turn a little bit then stop, or just vibrate. It was very erratic. I went through the driver circuit, which appeared fine, so I decided to remove the potentiometer portion of the code and set the stepper to just step X amount of times. Still didn't work. I then put a logic analyzer across the digital outs on the arduino to see what was being sent to the driver. Here is the output:
As you can see, the steps are not lining up correctly, nor are they staying turned off for long enough. Keep in mind, this is not even hooked up to the driver at the time I took this reading, so mismatched stepper settings shouldn't matter. Here is the code I'm using with the potentiometer stuff commented out. Any idea why it would be acting like this?? Thanks!
/*
* MotorKnob
*
* A stepper motor follows the turns of a potentiometer
* (or other sensor) on analog input 0.
*
* http://www.arduino.cc/en/Reference/Stepper
*/
#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(4);
// remember the previous value of the sensor
// previous = val;
}