Still experimenting with my first bit of code, RAH, to allow me to interface my ATC.
I have wired Mach input #1 to one of the onboard relays of the ATC that changes state whilst the ATC is in motion. My thought was that if I Sleep the RAH code for the longest period it takes to datum the ATC carousel, i.e. rotating all the way from station 6 to station 1, and then IsActive input #1 I can either continue through the program or initiate a user reset.
What I am not happy with is the DoButton(3) stop command as it doesn't seem correct as Mach isn't running any Gcode at this point so can't stop anything. I would like to initiate an Estop type of condition where the system prevents any further action until the reset button is pressed but I can't figure out what command is needed.
Please feel free to comment on the code in general for mistakes as I am still learning (guessing!) so I expect there are plenty.
thanks ...Sweep
DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )
Sleep(100)
While IsMoving()
   Sleep(100)
Wend
SendSerial("B0000133E167R25")
Sleep 2000
If IsActive(INPUT1) Then
   SendSerial("D44")
Else
   SetTicker(0,"Toolchanger datum failed ...check air supply")
   Dobutton(3)
End If
Sleep 5000
If IsActive(INPUT1) Then
   Message"ATC Datum Achieved"
Else
   SetTicker(0,"Toolchanger datum failed ...reset ATC")
   Dobutton(3)
End If