Hello Guest it is August 07, 2020, 09:30:04 AM

Author Topic: Buttons to turn on LED's  (Read 3093 times)

0 Members and 1 Guest are viewing this topic.

Buttons to turn on LED's
« on: August 14, 2008, 11:31:52 PM »
I looked through most of the posts in this section and not sure were to start on this code:(

I want to have 6 buttons with Led's next to them when you push one button the led next to it lights up when you push another button the led next that button lights up and the previous one goes off. 
Any one see a sample VB code for this and were will the code need to go(macro pump)?  Does each button need its own code?

I made the buttons and leds, can I use any OemLed number over 1000 for the led?

Offline KTM

*
  •  92 92
    • View Profile
Re: Buttons to turn on LED's
« Reply #1 on: August 15, 2008, 02:16:32 AM »
Download the oem codes.xls link: http://www.machsupport.com/forum/index.php/topic,6657.0.html

In screen4 select "VB function edited in mach" for your buttons.
Save and close screen4, open mach - operator - edit button script - insert code.
eg:(toggle button)

If GetOEMLED (78) Then
   DeActivateSignal(Output5)
Else
   ActivateSignal(Output5)
End If

Regards

KTM

Re: Buttons to turn on LED's
« Reply #2 on: August 15, 2008, 09:08:58 PM »
Do you mean a mach screen LED or a physical LED in a panel? The above answer would handle physical LEDs that were connected to Output# signals.


If you mean screen LEDs. then each button needs to have code in it like this. Assume we are using LED1000, 1001, 1002 etc Each button looks the same, except it turns on its number and off all the others

 Call SetUserLED (1001,1)   'button 1 turn on led 1
  Call SetUserLED (1002,0)  'turn off all otehrs
  Call SetUserLED (1003,0)
  Call SetUserLED (1004,0)
  Call SetUserLED (1005,0)
  Call SetUserLED (1006,0)


Re: Buttons to turn on LED's
« Reply #3 on: August 16, 2008, 08:47:44 AM »
Ron,

Thank you much that is what I need!!

I looked through the wiki and didn't see that you need to put call before the SetUserLED.  So i was trying with out the call and nothing worked.

« Last Edit: August 16, 2008, 09:06:36 AM by DennisCNC »