Hi,
I've been trying to modify this simple Adafruit Motor Shield sketch, so I can use it with Easy Driver and Arduino Uno Rev. 3, and can't seem to do it.
#include <AFMotor.h>
AF_Stepper motor(200, 2);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");
motor.setSpeed(10); // 40 rpm
for(int i = 0; i<310; i++) {
motor.step(25, FORWARD, INTERLEAVE); // 25 steps, 310 Times = 5 Minutes
delay(10000);
}
motor.release();
for(int i = 0; i<310; i++) {
motor.step(25, BACKWARD, INTERLEAVE); // 25 steps, 310 Times = 5 Minutes
delay(10000);
}
motor.release();
}
void loop() {
}
I trying to move my stepper motor forward a specific number of steps, a specific number of times and
repeat it backwards, so I can get back to where I started, just like the simple sketch above, but with and EasyDriver
Here's the easydriver sketch that I'm trying to modify, or maybe I should say trying to merge both sketches.
int Distance = 0; // records the number of steps we have taken
void setup () {
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
void loop() {
digitalWrite(9, HIGH);
delayMicroseconds(750);
digitalWrite(9, LOW);
delayMicroseconds(750);
Distance = Distance + 1; //record this step to see if we are et the end of our move
if (Distance == 80)
{
if (digitalRead(8) == LOW)
{
digitalWrite(8 , LOW);
}
else
{
digitalWrite(8, LOW);
}
Distance = 0;
delay(500);
Can anyone help me with this? Thanks.........Antonio
By the way, I was help with this in a previous post, but I'm not sure that it's necessary to give you that link.