Good morning, brand newbie, first attempt at editing LUA for Mach 4. I want to trigger a signal, open a pneumatic valve, delay, then turn off. I have been able to find examples and come up with the following code. I have tried to run in the edit/debugger, and the best I can get for a result is nil, however with that said, the best I can get for known code that does run is, nil. So, stumped. I am wondering if anyone out there is willing to comment on this code;
function m102 ()
local inst = mc.mcGetInstance() --Get the instance of Mach4
local IOName = mc.OSIG_OUTPUT1 --Save the name of the Signal (as stored inside of Mach4)
local ActivateSignalTime = 5000 --Time in milliseconds that we want the signal to be active.
local hReg = 0 --The handle to the signal
local rc = 0
hSig, rc = mc.mcSignalGetHandle(inst, IOName)
if (rc ~= 0) then --There was error
mc.mcCntlSetLastError(inst, "There was an error")
else
rc = mc.mcSignalSetState(hSig, 1) --Turn the output on
if (rc ~= 0) then --There was error
mc.mcCntlSetLastError(inst, "There was an error")
else
wx.wxMilliSleep(ActivateSignalTime) --Sleep for the commanded time (so that the output stays on as long as we want).
rc = mc.mcSignalSetState(hSig, 0) --Turn the output off
if (rc ~= 0) then --There was error
mc.mcCntlSetLastError(inst, "There was an error")
end
end
end
Thanks
Dave
I think that you are on the wrong site. This is a support site for Simple Machines Forum software... it sounds like you want to be on some other site (perhaps one that is using our software?)
^ yep.
Here's where you need to be (although you are already a contributing member there anyway ::))
https://www.machsupport.com/forum/
looks like hes up to some audio stuff programming wich are used generally in vst plugins ;)
QuoteHmmmm..... doubt
press X?