Hello Guest it is April 16, 2024, 05:22:34 AM

Author Topic: Sleep() doesn't work when called in Macro  (Read 2634 times)

0 Members and 1 Guest are viewing this topic.

Sleep() doesn't work when called in Macro
« on: May 21, 2014, 09:13:41 PM »
Hi,


I am running Mach version 3.043.066.
I have a CS-Labs CSMIO IP/S.

I wrote a macro M301 that I want to use to turn on an air solenoid for one second.  The code is:
SetPulley(1)
Pulley1On = OUTPUT3
Pulley2On = OUTPUT4
DeactivateSignal(Pulley2On)
ActivateSignal(Pulley1On )
Sleep(1000)
DeactivateSignal(Pulley1On )

This works properly when I am in the vbscript editor, but when I call it from MDI, the output is activated, but never deactivated. 
Thanks,

Bill

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Sleep() doesn't work when called in Macro
« Reply #1 on: May 22, 2014, 12:51:01 AM »
SetPulley(1)
Pulley1On = OUTPUT3
Pulley2On = OUTPUT4
DeactivateSignal(Pulley2On)
While Ismoving()
Wend
ActivateSignal(Pulley1On )
While Ismoving()
Wend
Sleep(1000)
DeactivateSignal(Pulley1On)
While Ismoving()
Wend
Re: Sleep() doesn't work when called in Macro
« Reply #2 on: May 22, 2014, 02:53:08 PM »
Thanks BR549!  It turns out that one of the problems was that somehow I ended up with two copies of the macro.  One was in the mach3/macros folder and one in the mach3/macros/myprofile folder.  But I see how yours should be more robust.  I look forward to trying it!

Bill