Hi,
I have never seen the scripts published anywhere. May I suggest you look at the SpinOn/SpinOff buttons in the Sreen editor.
The SpinCw and SpinCCW scripts are in the ScreenLoad script excerpted here:
---------------------------------------------------------------
function SpinCW()
local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON);
local sigState = mc.mcSignalGetState(sigh);
if (sigState == 1) then
mc.mcSpindleSetDirection(inst, 0);
else
mc.mcSpindleSetDirection(inst, 1);
end
end
---------------------------------------------------------------
-- Spin CCW function.
---------------------------------------------------------------
function SpinCCW()
local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON);
local sigState = mc.mcSignalGetState(sigh);
if (sigState == 1) then
mc.mcSpindleSetDirection(inst, 0);
else
mc.mcSpindleSetDirection(inst, -1);
end
end
Next suggestion is you need to write all your scripts in lower case, eg m4, m4 and m5. Mach's interpreter parses all Gcode to lowercase, strips out leading zeros and
whitespace. Usually human readable code is interpreted correctly but sometimes its not and it's a devil of a bug to find. Get used to writing all Gcode in lowercase.
I tend to still include whitespace for the sake of readability, but write Gcode in lowercase to better match Machs interpreter.
Craig