Hi,
I am trying to control a stepper motor (ROB-09238) using and Arduino Uno R3 and big easy driver. When I specify the steps (in Arduino Sketch), the stepper motor moves only a fraction of that amount (~steps/rpm). This motor has an angular resolution of 1.8 degrees (200 steps). I am trying to get it to rotate 1 revolution (200 steps). Any help would be appreciated.
Thanks,
#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(200, 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);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
stepper.setSpeed(60);
// 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) {
// Set Stepper
lcd.setCursor(1,2); // set cursor to column 0, row 2
lcd.print("Starting Stepper ");
stepper.step(200);
//delay(2000);
lcd.setCursor(1,2); // set cursor to column 0, row 2
lcd.print("Stopping Stepper ");
// turn LED on:
lcd.setCursor(2,3); // set cursor to column 0, row 3
lcd.print("Button is : ON ");
digitalWrite(ledPin, HIGH);
//delay(1000); // wait for a second
digitalWrite(ledPin, LOW);
//delay(1000); // wait for a second
buttonState = LOW;
stopRun = 1;
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
lcd.setCursor(2,3); // set cursor to column 0, row 3
lcd.print(“Button is : OFF”);
}
}