// MultiStepper.pde
// -*- mode: C++ -*-
// Use MultiStepper class to manage multiple steppers and make them all move to
// the same position at the same time for linear 2d (or 3d) motion.
#include <AccelStepper.h>
#include <MultiStepper.h>
// EG X-Y position bed driven by 2 steppers
// Alas its not possible to build an array of these with different pins for each :-(
AccelStepper stepper1(AccelStepper::DRIVER, 2, 3);
AccelStepper stepper2(AccelStepper::DRIVER, 4, 5);
AccelStepper stepper3(AccelStepper::DRIVER, 6, 7);
// Up to 10 steppers can be handled as a group by MultiStepper
MultiStepper steppers;
//string recibirdatos;
void setup() {
// Serial.begin(9600);
// Configure each stepper
stepper1.setMaxSpeed(100);
stepper2.setMaxSpeed(100);
stepper3.setMaxSpeed(100);
// Then give them to MultiStepper to manage
steppers.addStepper(stepper1);
steppers.addStepper(stepper2);
steppers.addStepper(stepper3);
}
void loop() {
// if (Serial.available()!=0){
// data=Serial.read();
// string[] arddata = recibirdatos.Split(';');
// txt_datox.Text =arddata[0] ;
// txt_dato_y.Text = arddata[1];
// Serial.println(data);
// }
long positions[3]; // Array of desired stepper positions
positions[0] = 1000;
positions[1] = 50;
positions[2] = 500;
steppers.moveTo(positions);
steppers.runSpeedToPosition(); // Blocks until all are in position
delay(1000);
// Move to a different coordinate
positions[0] = -100;
positions[1] = 100;
positions[2] = 100;
steppers.moveTo(positions);
steppers.runSpeedToPosition(); // Blocks until all are in position
delay(1000);
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
stepper1:A-
stepper1:A+
stepper1:B+
stepper1:B-
stepper2:A-
stepper2:A+
stepper2:B+
stepper2:B-
drv1:ENABLE
drv1:MS1
drv1:MS2
drv1:MS3
drv1:RESET
drv1:SLEEP
drv1:STEP
drv1:DIR
drv1:GND.1
drv1:VDD
drv1:1B
drv1:1A
drv1:2A
drv1:2B
drv1:GND.2
drv1:VMOT
drv2:ENABLE
drv2:MS1
drv2:MS2
drv2:MS3
drv2:RESET
drv2:SLEEP
drv2:STEP
drv2:DIR
drv2:GND.1
drv2:VDD
drv2:1B
drv2:1A
drv2:2A
drv2:2B
drv2:GND.2
drv2:VMOT
stepper3:A-
stepper3:A+
stepper3:B+
stepper3:B-
drv3:ENABLE
drv3:MS1
drv3:MS2
drv3:MS3
drv3:RESET
drv3:SLEEP
drv3:STEP
drv3:DIR
drv3:GND.1
drv3:VDD
drv3:1B
drv3:1A
drv3:2A
drv3:2B
drv3:GND.2
drv3:VMOT