This is my first attempt to program in Lua in the PLC script. Trying to turn on softlimits Here is the code that says syntax error.
I have no idea what I am doing... I put the code under the PLC First Run section which should be correct? Got to start somewhere...
Thanks!
-------------------------------------------------------
-- PLC First Run
-------------------------------------------------------
if (testcount == 1) then --Set Keyboard input startup state
local iReg = mc.mcIoGetHandle (inst, "Keyboard/Enable")
mc.mcIoSetState(iReg, 1) --Set register to 1 to ensure KeyboardInputsToggle function will do a disable.
KeyboardInputsToggle()
----------- turn on soft limits by kfc 12/2016
int TurnOn=MC_ON;
int axis=Z_AXIS;
mcSoftLimitSetState(inst, axis, TurnOn);
int axis = Y_AXIS;
mcSoftLimitSetState(inst, axis, TurnOn);
int axis = X_AXIS;
mcSoftLimitSetState(inst, axis, TurnOn);
-- ----------------------------------------------