Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: Toshio.K on August 08, 2021, 08:25:40 PM
-
Mach3 has "Go Home" on the numeric keypad, but I think Mach4 is difficult.
I attached the following script to the numeric keypad.
The motor turned and worked, but an error like the one in the picture was displayed.
Please tell me the solution.
-- Ref All Home() function.
if mc.mcSignalGetState (mc.mcSignalGetHandle (inst, mc.ISIG_INPUT60)) == 1 then
mc.mcAxisDerefAll(inst) --Just to turn off all ref leds
mc.mcAxisHomeAll(inst)
coroutine.yield() --yield coroutine so we can do the following after motion stops
----See ref all home button and plc script for coroutine.create and coroutine.resume
wx.wxMessageBox('Referencing is complete.\nSoft Limits Set.')
else
-- Do something else
end
-
Hi,
Have a look at DazTheGaz's video and you'll find a nifty trick to cause any keyboard key to trigger a script,
RefAllHome for instance.
https://www.machsupport.com/forum/index.php?topic=31585.0 (https://www.machsupport.com/forum/index.php?topic=31585.0)
Craig
-
Craig,
Thank you.
I have already seen this video.
I made two scripts.
Please look at the photo.
Cycle Start and Home.
I made the script in the same way, but only Home gives an error. I just don't know. Please tell me the solution.
-
Craig,
Thank you.
I changed the script as follows.
The error is gone.
-------------------------------------------------- ------------
--Ref All Home () function.
-------------------------------------------------- -------------
if mc.mcSignalGetState (mc.mcSignalGetHandle (inst, mc.ISIG_INPUT60)) == 1 then
mc.mcAxisDerefAll (inst) --Just to turn off all ref leds
mc.mcAxisHomeAll (inst)
else else
--Do something else
end