Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: yahuie on May 21, 2014, 09:13:41 PM

Title: Sleep() doesn't work when called in Macro
Post by: yahuie 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
Title: Re: Sleep() doesn't work when called in Macro
Post by: BR549 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
Title: Re: Sleep() doesn't work when called in Macro
Post by: yahuie 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