I would like to control two stepper motors with GBRL. I have to move the motors to a certain
position and after that position is arrived I need to switch two relais on and off - after that
the motors should move to the next position.
The releays need to be on and off in a sequence and are connected on 2 digital pins
Relay 1 - on / 50 ms delay / off
Relay2 - on / 120 ms delay (this would be good if this could be variable) / off
If you are only using 2 steppers with GRBL then maybe use the Z axis drive pins to control the 2 relays.
The direction pin could be used to select which relay to activate ( a little bit of logic) and the step pulse to activate the desired relay. Move Z plus for one and move Z minus for the other. Just need to play with the amounts to move the Z axis (maybe might need to play with # of steps per m.m. in the GRBL settings for the Z axis) to figure timing of ON time for the relay.
The step pin of course would need to be run thru a rc filter to filter out the pulses but once the move is done then the pin goes low.
Just one way to do it without doing any software changes.