Hi all,
I added some code to my spindle start button to check a couple of things before being able to manually start the spindle. Basically checking for a door switch to be closed. Code below:
local inst = mc.mcGetInstance() --new
if(mc.ISIG_INPUT5) and (state == 1) then -- need to map door switches to input 5...NPN input, so use ground and map input to active LOW
-- if the state is high then throw and error and exit
mc.mcCntlSetLastError(inst, "Error: Make sure doors are closed before attempting to start spindle") -- mew
do return end
else
SpinCW() -- original...this line only
end
I've got it in the the 'Left Up Script' where the factory 'SpinCW()' command is. Unfortunately, the code I added doesn't seem to do anything. I can start the spindle regardless of the state of this switch. Is this the correct location for this script or should it be somewhere else?