How does one poll for an input pin while using exec.Code for an axis move? I have a pair of crash sensors (push/pull) on a rotary changer and want to be able to stop motion if one of the sensors gets activated, for example if the drawbar does not open when commanded to. The sensors are working, I can activate them manually and show up on diagnostic screen. UCCNC appears to ignore inputs while using exec.Code. Here's a snippet I tried:
// Z up
if (Debug) { MessageBox.Show("Debug: Z up!"); }
exec.Code("G01 f100.0 G53 Z"+RetractZ);
//MessageBox.Show("Done sending code, proceeding into loop");
while(exec.IsMoving()) {
if (!AS3.GetLED(in_pullSensor_pin)) {
MessageBox.Show("Tool not released! Stopping tool change.");
exec.Stop();
}
exec.Wait(JamDetect_wait);
}
The while loop does not get activated until the exec.Code line is completed and returns to the macro so that didn't work. I also tried setting an input trigger for the 2 sensors with a trigger of 130 (cycle stop)--this works reliably outside of the macro when I set the Z axis moving using MDI and activate the sensors manually, but this also gets ignored while using the macro and the axis is moving. If I try to activate the sensors manually during the macro run the status screen does show 'cycle stop' from the input trigger but it does not stop motion.
I thought this would be easy and it probably is, just not for this novice.
Dan