Hello Guest it is April 19, 2024, 11:40:24 PM

Author Topic: How to attach "Go Home" to the numeric keypad  (Read 696 times)

0 Members and 1 Guest are viewing this topic.

How to attach "Go Home" to the numeric keypad
« 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
Re: How to attach "Go Home" to the numeric keypad
« Reply #1 on: August 08, 2021, 11:18:08 PM »
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

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: How to attach "Go Home" to the numeric keypad
« Reply #2 on: August 09, 2021, 01:39:28 AM »
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.
Re: How to attach "Go Home" to the numeric keypad
« Reply #3 on: August 09, 2021, 02:10:34 AM »
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