41
General Mach Discussion / Re: A Simple Macro
« on: March 03, 2013, 01:59:47 PM »
So, if anyone ever needs code for safety buttons, this is what I ended up with.
Here are the macros in a bit of sample code:
g1
M103 (Test that buttons aren't held/taped down)
M102 (Wait for both buttons to be pushed)
x0.195 y0.195 f20
z.5 f60
M103 (Test that buttons aren't held/taped down)
M101 (Wait for right button to be pushed)
x0.2 y0.2 f10
z1 f80
g0
z0
x0y0
m30
Here's the code for M103:
If IsLoading() Then
Else
Message "Please Release the Button"
While IsActive(INPUT1)
While IsActive(INPUT2)
Wend
Wend
DoOEMButton(172)
End If
M101:
If IsLoading() Then
Else
Message "Press Right Button to Continue"
While IsActive(INPUT2) = False
Wend
DoOEMButton(172)
End If
M102:
If IsLoading() Then
Else
Message "Press Both Buttons to Continue"
While IsActive(INPUT1) = False
While IsActive(INPUT2) = False
Wend
Wend
DoOEMButton(172)
End If
Here are the macros in a bit of sample code:
g1
M103 (Test that buttons aren't held/taped down)
M102 (Wait for both buttons to be pushed)
x0.195 y0.195 f20
z.5 f60
M103 (Test that buttons aren't held/taped down)
M101 (Wait for right button to be pushed)
x0.2 y0.2 f10
z1 f80
g0
z0
x0y0
m30
Here's the code for M103:
If IsLoading() Then
Else
Message "Please Release the Button"
While IsActive(INPUT1)
While IsActive(INPUT2)
Wend
Wend
DoOEMButton(172)
End If
M101:
If IsLoading() Then
Else
Message "Press Right Button to Continue"
While IsActive(INPUT2) = False
Wend
DoOEMButton(172)
End If
M102:
If IsLoading() Then
Else
Message "Press Both Buttons to Continue"
While IsActive(INPUT1) = False
While IsActive(INPUT2) = False
Wend
Wend
DoOEMButton(172)
End If