Hello Guest it is March 29, 2024, 04:31:28 AM

Author Topic: Terminate a brain with "run macro M650.m1s" ???????  (Read 39509 times)

0 Members and 1 Guest are viewing this topic.

Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #20 on: March 19, 2013, 08:46:23 AM »
Thanks Brett and Scott,
i understand what you mean Brett, so i'm trying the below. not sure
about brains...still learning as i never saw anything like brain.below changes
the leds but i have to change the 0,1 positions in the script.

Scott,
i couldn't get yours to wotk(you were missing a parenthesis
if i changed 1,0 position, it did change the led. but didn't change
when i would jog an axis. one more thing is that i didn't have a userDRO(2000,2001 or 2002)
not sure if i was suppose to make em or they're a system defaults.
Thanks again


X = GetUserLED(1120)
Y = GetUserLED(1121)
Z = GetUserLED(1122)

If IsMoving() Then
   GetOEMDRO(0)
   SetUserLED(X,1)
Else
   GetOEMDRO(0)
   SetUserLED(X,0)
End If

If IsMoving() Then
   GetOEMDRO(1)
   SetUserLED(Y,1)
Else
   GetOEMDRO(1)
   SetUserLED(Y,0)
End If

If IsMoving() Then
   GetOEMDrO(2)
   SetUserLED(Z,1)
Else
   GetOEMDRO(2)
   SetUserLED(Z,0)
End If
         
Kenneth
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #21 on: March 19, 2013, 09:19:53 AM »
stepping thru this, the program skips over the If
and goes straight to the Else. is this right ?
if i change SetUserLED(X,1) to SetUserLED(X,0)
the led changes
Kenneth

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #22 on: March 19, 2013, 09:39:31 AM »
If an led is one, it is on.  The leds are two state images.  Half the pictur is for on, the other half is off.  If the image doesnt have the right picture on the proper side, it will reflect the opposite of what it actually is.

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #23 on: March 19, 2013, 09:41:51 AM »
i have other leds that work as should. where do i find these pictur ?
Kenneth

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #24 on: March 19, 2013, 10:03:08 AM »
Open your screen in Mach screen and look at the properties for the led.  That will tell you where the picture resides.

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #25 on: March 19, 2013, 10:07:58 AM »
the image path is - None -
all my user leds have none but they work.
and all my picture are in Mach3\Bitmaps
and sub folder MillBitmaps
and i have Red/Green LED = Yes
« Last Edit: March 19, 2013, 10:14:13 AM by Kenneth »
Kenneth
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #26 on: March 19, 2013, 02:41:47 PM »
this doesn't change no matter 0 , 1

X = GetUserLED(1120)
Y = GetUserLED(1121)
Z = GetUserLED(1122)

If IsMoving() Then
   GetOEMDRO(0)
    SetUserLED (X,1)
   GetOEMDRO(1)
    SetUserLED (Y,1)
   GetOEMDrO(2)
    SetUserLED (Z,1)
Else
   GetOEMDRO(0)
    SetUserLED (X,0)
   GetOEMDRO(1)
    SetUserLED (Y,0)
   GetOEMDRO(2)
    SetUserLED (Z,0)
End If
       
Kenneth
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #27 on: March 20, 2013, 06:04:47 AM »
tried below again and added a UserDRO(2000) and when i changed
SetUserDRO(2000,CurrZPos) to tried below again and when i changed
SetUserDRO(2000,CurrZPos)  to SetUserDRO(2000,100) it changes
the dro(2000) to whatever i change the number to. so i was wondering
if "Curr?Pos" works? as the dro never changes with Curr?Pos. not sure
about Old?Pos either :)
Thanks


X_MovingLED = 1120
Y_MovingLED = 1121
Z_MovingLED = 1122
CurrXPos = GetOEMDRO(800)
OldXPos = GetUserDRO(2000)
CurrYPos = GetOEMDRO(801)
OldYPos = GetUserDRO(2001)
CurrZPos = GetOEMDRO(802)
OldZPos = GetUserDRO(2002)

if CurrXPos <> OldXPos then
   SetUserLED(X_MovingLED,1)
   SetUserDRO(2000,CurrXPos)
else
   SetUserLED(X_MovingLED,0)
   SetUserDRO(2000,CurrXPos)
end if

if CurrYPos <> OldYPos then
   SetUserLED(Y_MovingLED,1)
   SetUserDRO(2000,CurrYPos)
else
   SetUserLED(Y_MovingLED,0)
   SetUserDRO(2000,CurrYPos)
end if

if CurrZPos <> OldZPos then
   SetUserLED(Z_MovingLED,1)
   SetUserDRO(2000,CurrZPos)
else
   SetUserLED(Z_MovingLED,0)
   SetUserDRO(2000,CurrZPos)
end if
« Last Edit: March 20, 2013, 06:18:26 AM by Kenneth »
Kenneth
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #28 on: March 20, 2013, 07:23:36 AM »
Never mind :)
i see what i misunderstood about Curr?Pos and Old?Pos
Kenneth
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #29 on: March 20, 2013, 08:02:43 AM »
clicking run continuely in the VB editor makes the UserDRO(2002) change.
and about every third to fifth click makes the UserLED change(Red/Green)
the UserDROs 2000 and 2001 never change that i can see

X_MovingLED = 1120
Y_MovingLED = 1121
Z_MovingLED = 1122

CurrXPos = GetOEMDRO(0)
OldXPos = GetUserDRO(2000)
CurrYPos = GetOEMDRO(1)
OldYPos = GetUserDRO(2001)
CurrZPos = GetOEMDRO(2)
OldZPos = GetUserDRO(2002)


If CurrXPos <> OldXPos Then
   SetUserLED(X_MovingLED,1)
   SetUserDRO(2000,CurrXPos)
Else
   SetUserLED(X_MovingLED,0)
   SetUserDRO(2000,CurrXPos)
End If

If CurrYPos <> OldYPos Then
   SetUserLED(Y_MovingLED,1)
   SetUserDRO(2001,CurrYPo0)
Else
   SetUserLED(Y_MovingLED,0)
   SetUserDRO(2001,CurrYPos)
End If

If CurrZPos <> OldZPos Then
   SetUserLED(Z_MovingLED,1)
   SetUserDRO(2002,CurrZPos)
Else
   SetUserLED(Z_MovingLED,0)
   SetUserDRO(2002,CurrZPos)
End If
       
« Last Edit: March 20, 2013, 08:04:24 AM by Kenneth »
Kenneth