Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: mayhugh1 on December 18, 2009, 07:20:30 PM
-
I'm troubleshooting an OEM macro (that seems to work in version .029 but not in version .032) with little VB knowledge. It contains a line that I can't figure out:
"wait = GetOEMLED(11) = 0"
Is this line with two "=" symbols valid and if so can someone tell me what it is trying to do?
Thanks - Terry
-
In VB "=" means this equals that
wait = 4
msgbox wait 'returns 4
or
this = true
that = true
if this = that then
msgbox "they are the same"
End If
You would have to provide more of the code to figure out what is meant to happen.
Spindle ON LED (CW or CCW) = GetOemLED(11)
Are you checking to see if the spindle is on and how long to wait for?
Wait = 1000
If GetOEMLED(11) = True Then
Sleep(wait)
End IF
-
I'm still confused though about what the two equal signs on the same line are trying to do. It seems that a variable 'wait' is being assigned the boolean result of Get OEMLed(11), but what is the "=0" at the end doing? - Terry
-
looks to me that its saying to wait if OEMLED 11 is equal to zero, ie off.
Hood
-
I'm troubleshooting an OEM macro (that seems to work in version .029 but not in version .032) with little VB knowledge. It contains a line that I can't figure out:
"wait = GetOEMLED(11) = 0"
Is this line with two "=" symbols valid and if so can someone tell me what it is trying to do?
Thanks - Terry
It would be better written: "wait = (GetOEMLED(11) = 0)". It is valid, but perhaps poor coding practice. GetOEMLED(11) = 0 will be evaluated as a boolean expression, returning TRUE if OEM LED 11 is Off (0). So, wait will be set to TRUE (non-zero) if LED 11 is Off, and FALSE (zero) if LED 11 is on.
Regards,
Ray L.