Hello Guest it is April 24, 2024, 07:33:36 AM

Author Topic: Mach4 Enable/Disable Script  (Read 717 times)

0 Members and 1 Guest are viewing this topic.

Mach4 Enable/Disable Script
« on: August 27, 2021, 09:04:03 AM »
Hey Everyone,

I would like 2 physical button 1 to enable and the other to disable. These would replicated the onscreen "Enable" and "Disable" button in mach4. Is there a script to assign one of the inputs in Mach 4 to be an "Enable" button?

Peter
Re: Mach4 Enable/Disable Script
« Reply #1 on: August 27, 2021, 10:06:54 AM »
I use one button to toggle enable on the control panels here in the shop.
Just put the code in the signal library in the screen load script.
I modified my code so one input will enable mach and the other will disable mach.

[mc.ISIG_INPUT6] = function (state)
    if (state == 1) then
       local inst = mc.mcGetInstance();
        mc.mcCntlEnable(inst,1)
   end
end,

[mc.ISIG_INPUT7] = function (state)
    if (state == 1) then
       local inst = mc.mcGetInstance();
        mc.mcCntlEnable(inst,0)
   end
end,
Chad Byrd
Re: Mach4 Enable/Disable Script
« Reply #2 on: August 27, 2021, 11:57:04 AM »
I use one button to toggle enable on the control panels here in the shop.
Just put the code in the signal library in the screen load script.
I modified my code so one input will enable mach and the other will disable mach.

[mc.ISIG_INPUT6] = function (state)
    if (state == 1) then
       local inst = mc.mcGetInstance();
        mc.mcCntlEnable(inst,1)
   end
end,

[mc.ISIG_INPUT7] = function (state)
    if (state == 1) then
       local inst = mc.mcGetInstance();
        mc.mcCntlEnable(inst,0)
   end
end,

Thanks for you help this worked.

Do you know if its possible to do the same for M07(mist on) M08(coolant on) M09(off)?

Peter
Re: Mach4 Enable/Disable Script
« Reply #3 on: August 27, 2021, 02:20:45 PM »
Hi,

Never mind I found a script for it.

Peter
Re: Mach4 Enable/Disable Script
« Reply #4 on: August 27, 2021, 04:13:46 PM »
There is a lot you can do with the signal library with inputs. I use the same button to toggle enable, spindle, coolant, and the keyboard. I also have a button for reset, cycle start, and feedhold.
Chad Byrd