Hi
How to change this code to make steppers run one by one , and how to run process on a push button ?
The whole thing need to work like this :
press the button once
1- run stepper 1
delay
2- run stepper 2
delay
3- run stepper 3
wait next presing button
Because steppers run massive shafts ,code must have this options :
stepper1.setMaxSpeed(200.0);
stepper1.setAcceleration(100.0);
stepper1.moveTo(300);
I bought all parts for the machine ,but my parts stand 2 years.
I was trying to rewrite the codes , but I'm not going anywhere. I believe , someone of you can write code for 5 minutes.
// MultiStepper.pde
// -*- mode: C++ -*-
//
// Shows how to multiple simultaneous steppers
// Runs one stepper forwards and backwards, accelerating and decelerating
// at the limits. Runs other steppers at the same time
//
// Copyright (C) 2009 Mike McCauley
// $Id: MultiStepper.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $
#include <AccelStepper.h>
// Define some steppers and the pins the will use
AccelStepper stepper1(AccelStepper::DRIVER, 2, 3);
AccelStepper stepper2(AccelStepper::DRIVER, 9, 8);
AccelStepper stepper3(AccelStepper::DRIVER, 7, 6);
AccelStepper stepper3(AccelStepper::FULL2WIRE, 10, 11);
void setup()
{
stepper1.setMaxSpeed(200.0);
stepper1.setAcceleration(100.0);
stepper1.moveTo(24);
stepper2.setMaxSpeed(300.0);
stepper2.setAcceleration(100.0);
stepper2.moveTo(1000000);
stepper3.setMaxSpeed(300.0);
stepper3.setAcceleration(100.0);
stepper3.moveTo(1000000);
}
void loop()
{
// Change direction at the limits
if (stepper1.distanceToGo() == 0)
stepper1.moveTo(-stepper1.currentPosition());
stepper1.run();
stepper2.run();
stepper3.run();
}