Hi there!
I have hear an stepper motor nema17 (http://www.aliexpress.com/store/product/4-lead-Nema-17-stepper-motor-42BYGHM809-4200g-cm-59oz-in-1-68A-CE-ROHS-ISO/511874_562360153.html)
and Big Easy Driver (Version 1.2)
Well, I was experimenting with these codes (Easy Driver Examples)
but I have many problems. These codes does not work for me.
One big problem is that I can't get the opposite direction. I haven't seen my motor turns counterclockwise yet!
The whole project I want to achieve, is similar to the 5th example of the above page. With analogue value from a potentiometer for speed change, and pushbuttons to control start/stop, and direction.
Well my first query:
Should I use "Accelstepper" Library for something like this ? Is there any way to do it without the library?
2nd:
I was trying to do it without "Library" and I wrote this:
/*
Trying to control the motor with pushbuttons.
*/
const int buttonPin = 2; // set my buttons in Arduino Board
const int buttonPin2 = 3;
const int buttonPin3 = 4;
const int stepperstep = 9; // set the motor wires to the arduino board
const int stepperdirection = 8;
int buttonState = 0; // set my buttons in 0 or LOW position.
int buttonState2 = 0;
int buttonState3 = 0;
void setup() {
pinMode(buttonPin, INPUT); //set my Inputs and Outputs
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(stepperstep, OUTPUT);
pinMode(stepperdirection, OUTPUT);
digitalWrite(stepperstep, LOW); // Set the outputs from Arduino to BigEasyDriver to LOW.
digitalWrite(stepperdirection, LOW);
}
void loop() {
int sensorValue = analogRead(A0);
int buttonState = digitalRead(buttonPin);
int buttonState2 = digitalRead(buttonPin2);
int buttonState3 = digitalRead(buttonPin3);
if (buttonState == HIGH){
digitalWrite(stepperstep, HIGH); //try to push the button and start the rotation of the motor
}
else{
digitalWrite(stepperstep, LOW);
}
if (buttonState2 == HIGH){ // try to push the 2nd button and change the rotation of the motor
digitalWrite(stepperdirection, HIGH);
}
else {
digitalWrite(stepperdirection, LOW);
}
}
Nothing Happens when I upload this in my Arduino!!!
As I have read in the manual of Big Easy Driver, the STEP and DIR pin of BigEasyDriver accepts HIGH and LOW values.
That's why I'm trying to set these values with pushbuttons.
So, Am I in the right path? Or I should look in different ways?
Well, maybe I'm extremely wrong but I am a newbie, so please be kind with me.
Thank you.