Hi,
I am very new to the Arduino world. I just bought a 4 wire stepper motor, pushbutton, lcd, bigeasy motor driver and Arduino Uno to begin testing. I have had success with all except the stepper motor (ROB-09238). This motor has an angular resolution of 1.8 degrees (200 steps). I am trying to get it to rotate 1 revolution (200 steps). When I specify the steps (in Arduino Sketch), the stepper motor moves only a fraction of that amount (it appears to be ~steps/rpm...set steps to 200 at 60 rpm and it steps 3 at 0.5 steps per second. Set steps to 600 and it steps 10 at ~ 0.5 steps per second). Any help would be appreciated.
#include <LiquidCrystal.h>
#include <Stepper.h>
#define STEPS 200
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
Stepper stepper(100, 8, 9);
// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 7; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
int stopRun = 0;
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
stepper.setSpeed(60);
stepper.step(600);
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
lcd.clear(); // start with a blank screen
lcd.setCursor(4,1); // set cursor to column 0, row 0 (the first row)
lcd.print("Hello, World"); // change this text to whatever you like. keep it clean.
lcd.setCursor(1,2); // set cursor to column 0, row 2
lcd.print("Starting Diagnostic");
lcd.setCursor(2,3); // set cursor to column 0, row 3
lcd.print("Level 1 Begin");
}
void loop(){
// read the state of the pushbutton value:
if (stopRun == 0){
buttonState = digitalRead(buttonPin);
}
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
lcd.setCursor(1,2); // set cursor to column 0, row 2
lcd.print("Starting Stepper ");
stepper.step(200);
lcd.setCursor(1,2); // set cursor to column 0, row 2
lcd.print("Stopping Stepper ");
lcd.setCursor(2,3); // set cursor to column 0, row 3
lcd.print("Button is : ON ");
digitalWrite(ledPin, HIGH);
digitalWrite(ledPin, LOW);
buttonState = LOW;
stopRun = 1;
}
else {
// Set Stepper speed
// turn LED off:
digitalWrite(ledPin, LOW);
lcd.setCursor(2,3); // set cursor to column 0, row 3
lcd.print("Button is : OFF");
}
}