Thanks. I gave it a try by adding it to the end of the macro. For some reason it does not wait for the "Z home" signal before moving on to the next line of the Gcode program ( a G0 X/Y axis positioning move ). I also tried WAIT_MODE_LOW and it did the same thing. I was hoping the machine would stop all movement until the Z axis reached the home position. Any Ideas what I am doing wrong?
function M100()
local inst = mc.mcGetInstance()
local input_20 = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT20) -- Get handle for input 20
local input_20_State = mc.mcSignalGetState(input_20) -- Get input 20 state
local z_home_sig = mc.mcSignalGetHandle(inst, mc.OSIG_ZHOME) -- Get handle for Z axis home switch
if input_20 == 0 then
wx.wxMessageBox("Could not locate signal!")
else
if input_20_State == 1 then --If input_20_State equals 1, then the signal is active.
wx.wxMessageBox("Signal is already active!")
else --If input_20_State does not equal 1, then the signal is inactive.
mc.mcSignalSetState(input_20, 1)
mc.mcSignalWait(inst, z_home_sig, WAIT_MODE_HIGH, 20)
end
end
end
if (mc.mcInEditor() == 1) then
M100()
end