2
« on: August 16, 2019, 05:20:41 AM »
I am using a wirless transmitter to turn on and off the dust exreaction system I need it to turn on the output 50 for about half a second then turn it off then the same again to stop the dust extraction so I need a pulse on output50
I use a delay function calles wait in MC6 tool changer and though I could call that from here but no if I include the wait function in this code I get the same error even if I call it some thing different it still has the same error
This is the error
C:\Mach4Hobby\ZeroBraneStudio\bin\lua53.exe: C:\Users\Raymondo\AppData\Local\Temp\leA8EB.mcs:14: attempt to call a nil value (global 'wait')
stack traceback:
C:\Users\Raymondo\AppData\Local\Temp\leA8EB.mcs:14: in main chunk
Here is the script
-- Dust Collector button script
-- M110/M111 Output 50 signal 1100
inst = mc.mcGetInstance()
local hSig, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT50)
mc.mcSignalSetState(hSig, 1)
wait(1)
mc.mcSignalSetState(hSig, 0)
And I added this with or without it it is the same but this in in MC6 and works fine in MC6
function wait(seconds)
local start = os.time()
repeat until os.time() > start + seconds
end
any idea I just need about .3 to .5 seconds delay between turning on output50 and turning it off
regards Ray