Hello Guest it is May 21, 2019, 05:11:36 PM

Author Topic: Please take a look at my simple macro - is it correct?  (Read 5134 times)

0 Members and 1 Guest are viewing this topic.

Re: Please take a look at my simple macro - is it correct?
« Reply #10 on: April 18, 2010, 06:38:26 PM »
Gerry - So aside from "after your "Go Home" moves, you should probably add while ismoving...wend." does it look OK? This is the final step is completing my project and I am really excited to get it to work like I envisioned many months ago.

Also - hood just saw your post, thank you!

Offline Hood

*
  •  25,811 25,811
  • Carnoustie, Scotland
    • View Profile
Re: Please take a look at my simple macro - is it correct?
« Reply #11 on: April 18, 2010, 06:57:33 PM »
I looked at your macro and also noted you saying you are turning the Mist/Flood off again by Brains. What exactly are you doing with the Brains as I dont think the While IsMoving() will wait for a Brain. Also you mention Pots, do the Brains tie into with the Pots?

Hood
Re: Please take a look at my simple macro - is it correct?
« Reply #12 on: April 18, 2010, 07:07:20 PM »
Hood,

Hello. Yes, the brains tie in the with potentiometer.

The brain reads like this:

if value of potentiemeter is > 13, turn off mist, it works fine and takes about 1 second for the actuator to extend.

So if the macro will not wait for the brain, I wonder if I should remove the brain and incorporate the "mist off" via the marco. Like this:

Code "G0X9Y11" 'go to specified coordinate'
While IsMoving 'wait until stops moving'
Wend
Code "M8" 'mist on'
If GetOEMDRO(74) >13 Then
Code "M8" 'Mist Off'
Sleep (1000) 'wait For 1 Second'
Code "M7" 'flood on'
If GetOEMDRO(74) <12 Then
Code "M7"
If GetOEMLED(24) then 'if led 24 is active then end macro'
Code "G0X0YO" 'go home'
While IsMoving 'wait until stops moving'
Wend
End
Else 'if not'
Code "M8" 'mist on'
If GetOEMDRO(74) >13 Then
Code "M8" 'Mist Off'
Sleep (1000) 'wait For 1 Second
Code "M7" 'flood on'
If GetOEMDRO(74) <12 Then
Code "M7"
Code "G0X0Y0" 'go home'
Endif 'end macro'
« Last Edit: April 18, 2010, 07:13:08 PM by omegasea21 »

Offline Hood

*
  •  25,811 25,811
  • Carnoustie, Scotland
    • View Profile
Re: Please take a look at my simple macro - is it correct?
« Reply #13 on: April 18, 2010, 07:24:47 PM »
I would probably try it this way

Code "G0X9Y11" 'go to specified coordinate
While IsMoving 'wait until stops moving
Wend
Do
Code "M8" 'mist on
If GetOEMDRO(74) >13 Then Exit Do
Loop
Code "M9" 'Mist Off
Do
Code "M7" 'flood on
If GetOEMDRO(74) <12 Then Exit Do
Loop
Code "M9"
If GetOEMLED(24) Then 'if led 24 trch on is active then end macro
Code "G0X0Y0" 'go home
While IsMoving 'wait until stops moving
Wend
End
Else 'if not
Do
Code "M8" 'mist on
If GetOEMDRO(74) >13 Then Exit Do
Loop
Code "M9" 'Mist Off
Do
Code "M7" 'flood on
If GetOEMDRO(74) <12 Then Exit Do
Loop
Code "M9"
Code "G0X0Y0" 'go home
End if 'end macro
« Last Edit: April 18, 2010, 07:28:41 PM by Hood »

Offline Hood

*
  •  25,811 25,811
  • Carnoustie, Scotland
    • View Profile
Re: Please take a look at my simple macro - is it correct?
« Reply #14 on: April 18, 2010, 07:37:08 PM »
Thinking this may be better, but as said I am no VB guy so someone may come up with a more sensible way.

DROvalue = GetOemDRO(74)

Code "G0X9Y11" 'go to specified coordinate
While IsMoving 'wait until stops moving
Wend
Do
Code "M8" 'mist on
If DROvalue >13 Then Exit Do
Loop
Code "M9" 'Mist Off
Do
Code "M7" 'flood on
If DROvalue <12 Then Exit Do
Loop
Code "M9"
If GetOEMLED(24) Then 'if led 24 trch on is active then end macro
Code "G0X0Y0" 'go home
While IsMoving 'wait until stops moving
Wend
End
Else 'if not
Do
Code "M8" 'mist on
If DROvalue >13 Then Exit Do
Loop
Code "M9" 'Mist Off
Do
Code "M7" 'flood on
If DROvalue <12 Then Exit Do
Loop
Code "M9"
Code "G0X0Y0" 'go home
End if 'end macro
Re: Please take a look at my simple macro - is it correct?
« Reply #15 on: April 18, 2010, 07:42:37 PM »
Thank you. I will give it try!