Hello Guest it is December 06, 2019, 01:17:50 PM

Author Topic: Mach4 LED's  (Read 783 times)

0 Members and 1 Guest are viewing this topic.

Offline HL

*
  •  10 10
    • View Profile
Re: Mach4 LED's
« Reply #20 on: February 12, 2019, 02:42:30 PM »
Just in case anyone wants to do the same, here is the code I used.( No guaranty it will work for you, and No it is most certainly not optimized). Use at your own risk...........

Code: [Select]
if (mc.mcSpindleGetDirection(0) == 1) then
scr.SetProperty("txtBoxCW", "Value", "CW")

elseif (mc.mcSpindleGetDirection(0) == 0) then
scr.SetProperty("txtBoxCW", "Value", "OFF")
else
scr.SetProperty("txtBoxCW", "Value", "CCW")
end

local CoolSig = mc.mcSignalGetHandle(0, mc.OSIG_COOLANTON)
local State = mc.mcSignalGetState(CoolSig)
if State == 1 then
    scr.SetProperty("txtBoxCoolant", "Value", "Coolant On")


else
     scr.SetProperty("txtBoxCoolant", "Value", "Coolant Off")

end

local MistSig = mc.mcSignalGetHandle(0, mc.OSIG_MISTON)
local State2 = mc.mcSignalGetState(MistSig)
if State2 == 1 then
    scr.SetProperty("txtBoxMist", "Value", "Mist On")
else
     scr.SetProperty("txtBoxMist", "Value", "Mist Off")
end

Hope this clarifies things somewhat........

P.S. I find programming very boring and repetitive, but sometimes you just have to do thing your way........I guess.
« Last Edit: February 12, 2019, 02:46:11 PM by HL »