2) what is the best way to stop at the maximum deceleration speed but i dont want to come back.
#include <AccelStepper.h>
// Define some steppers and the pins the will use
AccelStepper stepper1; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
#define STOP_BTN A0 //input pin for stop button
bool curr_state, last_state;
void setup()
{
stepper1.setMaxSpeed(200.0);
stepper1.setAcceleration(100.0);
stepper1.moveTo(2400000);
pinMode(STOP_BTN, INPUT_PULLUP); //connect a normally open switch between A0 and Ground
curr_state = digitalRead(A0);
last_state = curr_state;
}
void loop()
{
last_state = curr_state;
curr_state = digitalRead(STOP_BTN);
if ((curr_state != last_state) && (curr_state == LOW)) //call stop() once when the button was pressed
stepper1.stop();
stepper1.run();
}I was calling stop and breaking the loop. I was thinking that the stop made it to stop, but rather I didn't call run or run to position and that's why it stopped. My bad.
Thanks again for the wonderful help
Joe