Hello,
I’ve made good progress now and have all 3 axis working.
I’ve got a setup with 3 stepper motors on X ,Y and Z axis driven by a Pololu Tic500 on each axis, controlled by USB from the Raspberry. Separate X, Y and Z setup routines to allow each axis to define a Start, End and Increment size work and allows the motors to increment Y, then X and finally Z with predefined Start, End and Increments. This is a camera/lens setup where the camera/lens is attached to a Z linear rail, X & Y linear rails move the subject. All the linear rails are driven my stepper motors, which turn motor rotation into linear movement.
All works well, however I need to go to each X position, at each Y position and setup a specific Z axis Start, End and Increment size for each X position at each Y position, so a specific Z Start, End and Increment for each predefined X of Y position is required.
A nested “for” loop of Y overall, with X and then Z runs fine and positions all 3 stepper motors at the correct positions with the predefined setup Start, End and Increment size for X, Y and Z. I’ve tried using the same nested stepper motor position routines “for X loop” inside a “for Y loop” to move to the desired Y and X positions , but using the Z Start, End, Increment setup routine to capture the Z parameters at each Y and X position. The Z axis Start, End, Increment routine only gets run once then bypassed, as if it’s ignored for the rest of the Y and X “for” loops. Here’s the basic general concept;
for y in range (y number of increments ):
move to y position
y position = y position + y increment
for x in range (x number of increments):
move to x position
x position = x position + x increment
z axis start end increment routine
print z parameters
print x parameters
print y parameters
This is the same sequence that runs everything fine with “z axis start end increment routine” replaced with;
for z in range (z number of increments):
move to z position
z position = z position + z increment
Any help is greatly appreciated,
Best,
Mike