Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Raychar on December 21, 2015, 01:10:28 PM

Title: Problem in OEM button
Post by: Raychar on December 21, 2015, 01:10:28 PM
Hi everybody,

I made a button and LED on a new screen by Screen4 together with the following VB script in Macropump. However, when the button is pressed, the LED won't lit. Can anybody advise what's wrong with it... Or, my concept goes wrong!

Sub Main

If GetOemButton(2000)=1 Then
SetUserLED(1000,1)
Else
SetUserLED(1000,0)
End If

End Sub

Thanks in advance.
Title: Re: Problem in OEM button
Post by: ger21 on December 21, 2015, 06:47:38 PM
There is no GetOEMButton Function.

Just use this code in the button. No need to put this in the macropump.

If Not GetOEMLED(1000) Then
SetUserLED(1000,1)
Else
SetUserLED(1000,0)
End If
Title: Re: Problem in OEM button
Post by: Raychar on December 22, 2015, 07:57:17 AM
I can't get it.

Originally, in my new added control button in the screen, I entered 2000 in the blank of OEM Code Function and its box was checked. Whereas, in LED one, I entered 1000 in OEM Code Function.
In your codes, there is only OEM LED 1000, I don't know how button and LED are linked together and ,which location the codes should be placed? Sorry for that I am a newbie of in screendesigner.....
Title: Re: Problem in OEM button
Post by: ger21 on December 22, 2015, 08:06:38 AM
In Screen 4, configure the button to execute VB Script.
Then, in Mach3, go to the Operator menu, and select "Edit Button Script". Click on the button, and enter the code I posted in the script editor that opens. Go to File > Save in the VB editor, then close it.

When you click the button, it will toggle the LED on and off.

I'm not sure if 1000 is a valid User LED number. You might ant to use a higher vale, over 1200 or so?
Title: Re: Problem in OEM button
Post by: Raychar on December 22, 2015, 09:59:33 AM
Thanks a lot, it works now. This information is very helpful which I can't find out anywhere in net...