Mach3 Robotic arm VBScript vertical Move until input
Hello CNCZone Forum,
I am currently programming robot arm for my self but ran into some problems.
What I want is that Z & Y Moves down at the same time to create a vertical move until a sensor is activated then waits for 2 sec and then starts moving back up.
It should look something like this:
Move vertical down ---> (Sensor On) Stop moving ---> Wait 2 sec ---> move vertical back up
I know little to none about programming with VBScript i have attempted to make a code by my self but i can't get it to work like i want.
To make it a vertical move i have to move Z & Y at the same time but, when I use a probe G-code (G31) he only moves Z until the sensor is activated after that he doesn't do anything until the sensor is deactivated and then he continues his probe down wards instead of moving back up.
I tried to use a G0 instead of an G31 code but, then he didn't stop while the sensor was activated
============Notes============
The robotic arm is controlled by an NVEM CNC controller and Mach3
Input1 & Probe are both connected to the same sensor
My G-code:
G0 X0 Y0 Z0
G0 X-10
M1002
G0 X-10 Y0 Z0
G0 X0
My VBScript (M1002) code:
MaxR = 1
If IsActive(Input1) Then
MaxR = 0
End If
While MaxR = 1
Code "G31 Y -15 Z -20 F80"
While isMoving()
If IsActive(Input1) Then
MaxR = 0
End if
Wend
Wend
Sleep 100
Exit Sub