hi all
i am retrofitting a bridgeport mill and the oiler is on an electric timer motor the timer orriginally ran when the spindle contactors were engaged. i have added a vfd and removed the contactors then added a relay to run the oiler. now with mach upgrade we can also probe and when probing the spindle doesnt run however we still need to run the oiler. mach 3 had a vb command ismoving and i have used this in the past effectively. i am trying to do the same with mach 4 but am still fuzzy on lua or you could say clueless. this is the code i have come up with.
if (machEnabled == 1) then
runLube()
end
function runLube()
local inst = mc.mcGetInstance()
local hsig,rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT0)
if (mc.mcCntlIsStill(inst)==1) then
mc.mcSignalSetState(hsig, 0)
wx.wxMessageBox("output 0 on")
else
mc.mcSignalSetState(hsig, 1)
wx.wxMessageBox("output 0 off")
end
end
this ran in plc script but didnt run when homing or when g-code was running, however when i jogged it ran as planned also i remmed out the message boxes when i saw the output working. i tried to get this to run in signal script without success. all i need is for it to turn on the output when an axis ismoving if you can help me thank you
mark