Hi,
Yes I started to read, but as you stated it wasn't quite obvious so I put focus on changing from G-code to JOG and while waiting for for input on that, start to investigate more in the signal table.
Now, I have done my best implementing it in the Signal table and this is my outcome, how do it look?
Must I put "RC =" before the mc.mcJog********* string or will it execute anyway?
I also added to check if the axis is homed aswell.
[mc.ISIG_INPUT1] = function (state)
if (state == 1) then
hSig, rc = mc.mcSignalGetHandle( inst, mc.OSIG_RUNNING_GCODE )
if rc == 0 then
GC_State = mc.mcSignalGetState(hSig)
if GC_State == 1 then --GCode is running, better not let the turret to be turned!
wx.wxMessageBox('GCode is running')
else --Gcode is not running, it should e safe to rotate the turret!
hSigHome, rc = mc.mcMotorIsHomed(inst, 8);
HomeState = mc.mcSignalGetState(hSigHome);
if HomeState == 1 then -- The turret motor seem to be homed, lest rotate the turret
mc.mcJogIncStart(inst, 8, 0.1) --Axis 8
mc.mcJogIncStop(inst, 8, 360) --360*0.1=36 degrees
wx.wxMessageBox('Sucessfully rotated the turret! FTW!')
else
wx.wxMessageBox('Turret motor is not homed, please home the machine!')
end
end
else
wx.wxMessageBox('rc returned '..tostring(rc))
end
end
end,/code]