Welcome, Guest. Please login or register.
Did you miss your activation email?
February 12, 2012, 09:28:38 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  activate macro when input is triggered
Pages: 1   Go Down
Print
Author Topic: activate macro when input is triggered  (Read 642 times)
0 Members and 1 Guest are viewing this topic.
tmead
Active Member

Offline Offline

Posts: 61


View Profile
« on: March 11, 2010, 12:50:14 PM »

OK, so I found the following in a post, which is fine, except I'm stuck right at the beginning. I'm not sure where the 'trigger code box' is for option 1. I'm scared of writing a brain - out goes number 2, and I can't find anywhere to tell me which command to use to access the input in a macro. I'm assuming it must be something like GetInput (INPUT1) ?

All help welcome - I've been creating screens and simple macros for a while, but it's time to go a little further ! We're using Mach to drive lab rigs, and it's working a treat, but I want to use a couple of hardware buttons to do certain things.

Tim



you can do it three ways..... for example macro  "M333.m1s"

1).  Put OEM code 301 into your trigger code box next to the OEM input your bringin in. Then put SetTriggerMacro(333) into your init line under general.

2) you can use Brains: put the same init line above, then have your imput map to the terminator under buttons "execute button script"

3). You can have Macro pump watch for your trigger input to go hot, then in an if statement it can run the macro as a Code Call.

here is a Macro that does what you want.

M333.m1s

If GetOEMLED(800) Or Not GetOEMLED(999) Then  'machine in estop or not moving so reset and load run file
   If GetOEMLED(800) Then  'if in reset
   DoOEMButton(1021)   'push reset
   End If
   Code("G4 P0.5")      'Pause here is required from first boot up to give time from reset
   While IsMoving()   'time to complete code/move
   Wend
   If Not GetOEMLED(999) Then   'if machine is NOT moving (note 804 "run led" doesnt work well)
   DoOEMButton(1022)   'Home the X
   DoOEMButton(1023)   'Home the y
   While IsMoving()   'time to complete code/move
   Wend
   Loadrun("C:/Mach3/GCode/mygcodefile.TAP") 'this will load and execute this file replace with your path and file
   Message("   Hey Wife, I will let you spend alot of money at walmart if you cut the grass and paint the house")
   End If
Else
 If GetOEMLED(999) Then  'If machine is moving
 Message("     Currently Running a Part!, see if wife finished with Grass and house")
 End If
End If

'Note you will need to push the "clear" button to clear the
'messages it is next to the Reset button

'sample G code file is attached in match it to the above directory.
'the macro M333.m1s is also attached to this post

'enjoy, and welcome to the support group

'Scott S
Logged
tmead
Active Member

Offline Offline

Posts: 61


View Profile
« Reply #1 on: March 11, 2010, 12:59:55 PM »

OK - Probably a little quick on the draw there.

I'm hoping that what I need will be in here : http://www.machsupport.com/forum/index.php/topic,12740.0.html

Tim
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!