Hello Guest it is April 18, 2024, 09:04:02 AM

Author Topic: new button and led  (Read 6874 times)

0 Members and 1 Guest are viewing this topic.

Offline amnon

*
  •  40 40
    • View Profile
Re: new button and led
« Reply #10 on: February 07, 2015, 02:24:41 PM »
Code: [Select]
SetOEMDRO(818, 10000)
If GetOemLed (14)=0 Then 
'Code "(I am turning on Joge)"
DoOEMButton(103)
Else
End If

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: new button and led
« Reply #11 on: February 07, 2015, 03:06:50 PM »
Try this

SetOEMDRO(818, 10000)
If GetOemLed (14)= 0 Then
DoOEMButton(204)   
End If   


Hood

Offline amnon

*
  •  40 40
    • View Profile
Re: new button and led
« Reply #12 on: February 08, 2015, 09:02:29 AM »
Thank's Hood,
But, what code should I add to this one, to turn on my LEDS

Amnon

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: new button and led
« Reply #13 on: February 08, 2015, 09:04:51 AM »
What is the LED to signify and when do you want it on and when off?
Hood

Offline amnon

*
  •  40 40
    • View Profile
Re: new button and led
« Reply #14 on: February 08, 2015, 09:14:06 AM »
Signification of my LED is to show me that my button was pressed. So I want it on, when feed rate is changening by pushing my button.

Amnon

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: new button and led
« Reply #15 on: February 08, 2015, 01:59:36 PM »
It would be a very simple matter to turn the LED on but the problem would be turning it off again when the circumstances had changed, ie the DRO does not have that value in it or the Jog mode is other than continuous.
What you would need to do is use the macropump or a Brain for that rather than trying to do it from within the button itself.

You would just look at the value in the DRO and the state of the Jog LED and if both were right you would turn the User LED on, if they were not both in the right state then turn it off.

Hood

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: new button and led
« Reply #16 on: February 08, 2015, 02:21:58 PM »
Just tested this in the macropump and it works fine.

If GetOemDRO(818)=10000 And GetOemLED(14) Then
SetUserLED(2000,1)
Else
SetUserLED(2000,0)
End If

What you will need to do if you do not already have the macropump is firstly go to General Config page and enable the macropump.
Then Operator menu and VB Script editor. In the window that opens paste the code above then save the file as macropump.m1s  making sure you save it to the macro folder of the profile you are using.
You will then need to add a User LED to your screenset and give it the OEM code of 2000.

When you next open Mach it should light the LED if the DRO is 10000 and the Jog mode is Continuous, as soon as either of these change the LED should go out.

Hood

Offline amnon

*
  •  40 40
    • View Profile
Re: new button and led
« Reply #17 on: March 08, 2015, 12:46:23 PM »
Hej Hood,

Your code works fine, now I try to add next UserLED to probe button. My intension is to set my LED when a probe button was pressed, and turn them off when probing is finished. I add to macropump
Code: [Select]
If button34 = 1 Then
SetUserLED(1406,1)
Else
SetUserLED(1406,0)
End if

but It doesn't work.
It is a little strange for me, that all buttons with my different macros have the same number 34. Can I change a button number?

Amnon

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: new button and led
« Reply #18 on: March 08, 2015, 06:11:41 PM »
Where do you get the code

If button34

from?

Hood

Offline amnon

*
  •  40 40
    • View Profile
Re: new button and led
« Reply #19 on: March 09, 2015, 02:05:25 AM »

I found this part of code in some macro.

Amnon