AccelSteppr has no built-in mechanisms for synchronising 2 steppers
You may want to set the speeds of the 2 steppers to achieve simultaneous
movement?
Cheers.
--
Mike McCauley mi...@open.com.au
Open System Consultants Pty. Ltd
9 Bulbul Place Currumbin Waters QLD 4223 Australia http://www.open.com.au
Phone +61 7 5598-7474 Fax +61 7 5598-7070
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
Platypus, Freeside, TACACS+, PAM, external, Active Directory, EAP, TLS,
TTLS, PEAP, TNC, WiMAX, RSA, Vasco, Yubikey, MOTP, HOTP, TOTP,
DIAMETER etc. Full source on Unix, Windows, MacOSX, Solaris, VMS, NetWare etc.
So something like
AccelStepper motora = new AccelStepper(...);
AccelStepper motorb = new AccelStepper(...);
long targeta = 1000;
long targetb = 500;
motora.moveTo(targeta);
motorb.moveTo(targetb);
// work out speed
int maxSpeed = 1000;
float speedRatio = 1.0;
// two cases to decide which motor should run at full speed
// and which should run at a fractional speed
if (targeta > targetb) {
// motor b has less distance to go, and so will run slower than
speedRatio = targetb / targeta; // result is 500/1000 = 0.5
motora.setSpeed(maxSpeed);
motorb.setSpeed(maxSpeed * speedRatio);
}
else if (targeta < targetb)
targetb / targeta; // result = 0.5
motora.setSpeed(maxSpeed);
while (motora.distanceToPosition() != 0
&& motorb.distanceToPosition() != 0)
{
motora.run();
motorb.run();
}
--
Sandy Noble
AccelStepper motora = new AccelStepper(...);
AccelStepper motorb = new AccelStepper(...);
long targeta = 1000;
long targetb = 500;
motora.moveTo(targeta);
motorb.moveTo(targetb);
// work out speed
int maxSpeed = 1000;
float speedRatio = 1.0;
// two cases to decide which motor should run at full speed
// and which should run at a fractional speed
if (targeta > targetb)
{
speedRatio = targetb / targeta; // result is 500/1000 = 0.5
motora.setSpeed(maxSpeed);
motorb.setSpeed(maxSpeed * speedRatio);
}
else if (targeta < targetb)
{
speedRatio = targeta / targetb;
motora.setSpeed(maxSpeed * speedRatio);
motorb.setSpeed(maxSpeed);
}
else
{
motora.setSpeed(maxSpeed)
motorb.setSpeed(maxSpeed)
}
// now run the actual motors
while (motora.distanceToGo() != 0
&& motorb.distanceToGo() != 0)
{
motora.runSpeed();
motorb.runSpeed();
}
Does that make any sense?
sn
--
Sandy Noble
...
for (int i = 0; i < 360; i++)
{
angle = i*2*3.14/100;
Xpos = CircleXCenter + (cos(angle) * Rad);
Ypos = CircleYCenter + (sin(angle) * Rad);
motorX.moveTo(Xpos);
motorY.moveTo(Ypos);
while (motorX.distanceToGo() != 0 && motorY.distanceToGo() != 0)
{
motorX.run();
motorY.run();
}
}
Might still be barking, ha.
sn
--
Sandy Noble