827
« on: December 27, 2016, 04:48:18 PM »
I'm setting up a new machine and I have 2 buttons on my control panel, one to toggle the spindle and one to toggle the coolant. I haven't figured out how to toggle them on and off in the signal library.
Button1 is set to input 1
Here is what I am wanting:
Input1 triggered ----> turn on coolant
Input1 triggered again ----> turn off coolant
I keep referencing the scripting manual but I can't figure out what the signal table is or where to put it. I'm working in the screen load script under Signal Library. I've made the button turn on the coolant on the press and then it shuts off on the release.
Is this possible in the signal library?
Here is what i've worked on so far and have gotten practically nowhere
----Input 1 Coolant On/Off --------------> THIS KEEPS COOLANT ON BUT DOESN'T TURN IT OFF 12/27/16
--[mc.ISIG_INPUT1] = function (on_off)
-- if mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON, 0) then
-- if (on_off == 1) then
-- local OSigCool = mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON)
-- mc.mcSignalSetState(OSigCool,1)
-- mc.mcCntlSetLastError(inst, "Coolant On")
-- end
-- else
-- if (on_off == 1) then
-- local OSigCool = mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON)
-- mc.mcSignalSetState(OSigCool,0)
-- mc.mcCntlSetLastError(inst, "Coolant Off")
-- end
-- end
--end,
----------------------> this turns on with press and turns off with release
--Input 1 Coolant On/Off
--[mc.ISIG_INPUT1] = function (on_off)
-- if (on_off == 1) then
-- local OSigCool = mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON)
-- if mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON, 0) then
-- mc.mcSignalSetState(OSigCool,1)
-- mc.mcCntlSetLastError(inst, "Coolant On")
-- end
-- else
-- local OSigCool = mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON)
-- if mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON, 1) then
-- mc.mcSignalSetState(OSigCool,0)
-- mc.mcCntlSetLastError(inst, "Coolant Off")
-- end
-- end
--end,
Any help would be great.