Hello Guest it is March 28, 2024, 11:04:50 AM

Author Topic: Ref All Home from an external switch  (Read 2269 times)

0 Members and 1 Guest are viewing this topic.

Ref All Home from an external switch
« on: January 14, 2015, 09:45:57 PM »
Hi,
im trying to set up an external button to home my machine. What I want to be able to do is eactly whats in the Ref Home button script, so the logical thing to do would be to map the hardware button press to the OEM button number. Problem is I cant find the button number and from reading, dont think there is one.
So, I tried a macropump....
Switch connected to input #1
Code: [Select]
If IsActive (input1) Then
DoOemButton (1024)
DoOemButton (1023)
DoOemButton (1022)
DoOemButton (1025)

DoOemButton (133)
DoOemButton (134)
DoOemButton (135)
End If
Which is the same as in my button script.


But what happens here, is that all axis home at the same time, not one after the other.
This is not what I want as I would like z to home first so that the tool clears anything on the table when moving X and Y, just like the "Ref All Home" button on the screen.

What am I doing wrong?

Regards

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Ref All Home from an external switch
« Reply #1 on: January 15, 2015, 02:52:58 AM »
You will have to add a

While IsMoving()
Wend

after each axis move.

Hood
Re: Ref All Home from an external switch
« Reply #2 on: January 15, 2015, 03:58:02 AM »
Perfect! Thanks for the tip.

As an additional question to this regarding macropumps.....
Can I add more "If" statements for other switches in this macropump? For example if I want to use this pump to do an action dependent on the switch connected to input2, can I just then continue the code  with another "If IsActive (input2) ..... End If" ?

Or would I be better using (learning!) to use a brain/s instead?

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Ref All Home from an external switch
« Reply #3 on: January 15, 2015, 05:58:16 AM »
Adding to the macropump is fine to an extent. If it gets very long then it will get slow as it gets read in a loop. However you will not be anywhere near that issue with a few switches.

Hood