553
« on: January 06, 2017, 09:07:58 AM »
This is an example that is in the default screens. Most of it is commented out and it doesn't have as many comments but what it does is sets up input one to do two things. Cycle start and feed hold. It acts like a dead man if used with a momentary switch.
You push the switch in, input one changes states from 0 (off) to 1 (on), the function runs which checks the state of the switch and if == 1 it runs the CycleStart function (found further down in the screen load script).
When you release the button the state of input one changes again and it now == 0 (off). So, since the state changed from 1 to 0 the function runs again which checks the state and if anything other than 1 run the mc.mcCntlFeedHold API call.
[mc.ISIG_INPUT1] = function (state) --Add input one to the signal table so this function runs each time input one changes states.
if (state == 1) then --If the state of input one equals 1 (on) run the CycleStart function.
CycleStart()
else --The state of input one does not equal 1
mc.mcCntlFeedHold (0) --Feed hold instance 0 of Mach4
end
end,