11
Mach4 General Discussion / ok lua lost on screen button
« on: March 17, 2020, 10:28:09 PM »
Hello
I am just confused and have read so much that I am even more lost. LOL
Can somebody help
I want a screen button to read input 9 and if input 9 is off then turn on output 8
until input 9 is on. then turn off output 8. seemed simple
The object is a tool changer manual button to go to the spindle so you click the button and
if the tool holder is at park then the switch "input 9" is off so turn the motor on "output 8"
when the "input 9" turns on turn the motor "output 8" off.
This is what i have so far notice their are two different as not sure which signal get handle are the proper form.
And the signal get state if then loop just has to be all kinds of wrong
local inst = mc.mcGetInstance()
local ToolDrumAtSpindle = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT9)
local ToolDrumToSpindle = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT8)
if mc.mcSignalGetState(ToolDrumAtSpindle ==1 ) then
mc.mcSignalSetState(ToolDrumToSpindle,0)
else
mc.mcSignalSetState(ToolDrumToSpindle,1)
end
--local inst = mc.mcGetInstance()
--local ToolDrumAtSpindle = mc.ISIG_INPUT9
--local ToolDrumToSpindle = mc.OSIG_OUTPUT8
-- if mc.mcSignalGetState(ToolDrumAtSpindle,1) then
-- mc.mcSignalSetState(ToolDrumToSpindle,0)
-- else
-- mc.mcSignalSetState(ToolDrumToSpindle,1)
--end
Never did a button before except to just turn on or off an input.
Thank you
Mark
I am just confused and have read so much that I am even more lost. LOL
Can somebody help
I want a screen button to read input 9 and if input 9 is off then turn on output 8
until input 9 is on. then turn off output 8. seemed simple
The object is a tool changer manual button to go to the spindle so you click the button and
if the tool holder is at park then the switch "input 9" is off so turn the motor on "output 8"
when the "input 9" turns on turn the motor "output 8" off.
This is what i have so far notice their are two different as not sure which signal get handle are the proper form.
And the signal get state if then loop just has to be all kinds of wrong
local inst = mc.mcGetInstance()
local ToolDrumAtSpindle = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT9)
local ToolDrumToSpindle = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT8)
if mc.mcSignalGetState(ToolDrumAtSpindle ==1 ) then
mc.mcSignalSetState(ToolDrumToSpindle,0)
else
mc.mcSignalSetState(ToolDrumToSpindle,1)
end
--local inst = mc.mcGetInstance()
--local ToolDrumAtSpindle = mc.ISIG_INPUT9
--local ToolDrumToSpindle = mc.OSIG_OUTPUT8
-- if mc.mcSignalGetState(ToolDrumAtSpindle,1) then
-- mc.mcSignalSetState(ToolDrumToSpindle,0)
-- else
-- mc.mcSignalSetState(ToolDrumToSpindle,1)
--end
Never did a button before except to just turn on or off an input.
Thank you
Mark