i add an external button to enable mach4 after pc turn on
[mc.ISIG_INPUT0] = function (state)--external button on
if( state == 1) then
local inst = mc.mcGetInstance()
mc.mcCntlSetLastError(inst, "but enable ");
mc.mcCntlEnable(inst,1)
local Zbrake = mc.OSIG_OUTPUT9
local hsig1 = mc.mcSignalGetHandle(0, Zbrake) ------servo on
mc.mcSignalSetState(hsig1, 1)
mc.mcCntlSetLastError(0, "servo on");
local zb= mc.OSIG_OUTPUT1
local zb11 = mc.mcSignalGetHandle(0, zb) ------z brake
mc.mcSignalSetState(zb11, 1)
end
end ,
i use the attach even handler (quit simple i think)
but strange behaviour
1. if i try first time by button mach4 crash
2. if i enable from mach interface first time ,then disable ,then by button work good
even many times ,disable enable....ets its ok ,but s mention first time must be from mach, why?
thanks
yaakov