Welcome, Guest. Please login or register.
Did you miss your activation email?
December 02, 2008, 07:12:05 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Buttons to turn on LED's
Pages: 1   Go Down
Print
Author Topic: Buttons to turn on LED's  (Read 235 times)
0 Members and 2 Guests are viewing this topic.
DennisCNC
Active Member

Online Online

Posts: 184


View Profile
« on: August 14, 2008, 10: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?
Logged
KTM
Active Member

Online Online

Posts: 42


View Profile
« Reply #1 on: August 15, 2008, 01: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

Logged
Ron Ginger
Active Member

Online Online

Posts: 266



View Profile WWW
« Reply #2 on: August 15, 2008, 08: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)


Logged
DennisCNC
Active Member

Online Online

Posts: 184


View Profile
« Reply #3 on: August 16, 2008, 07: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, 08:06:36 AM by DennisCNC » Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!