Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 12:40:41 PM

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
| | |-+  How do I use VB to turn a LED on & off on the screen?
Pages: 1   Go Down
Print
Author Topic: How do I use VB to turn a LED on & off on the screen?  (Read 1546 times)
0 Members and 2 Guests are viewing this topic.
Darc
Active Member

Offline Offline

Posts: 177


View Profile
« on: February 19, 2007, 05:53:45 AM »

I would like to run a small program, that will also turn on an LED
e.g
CODE "TURN LED ON HERE"
CODE "G90 G55 G21"
CODE "G00 Y100."
CODE "G01 Y110. F100"
CODE "G00 Y300."
CODE "M30"
CODE "TURN LED OFF HERE"

What's the best way to achieve this?
Logged
CNC-Steuerung
Active Member

Offline Offline

Posts: 52


View Profile
« Reply #1 on: February 19, 2007, 12:59:37 PM »

Hi Darc,

first you should define a M-Macro like M100 for Led on and M101 for LED off.
Then can use the whole VB-Script language for your Macros..

M100:

SetUserLED (nnnn, 1)   ' Led on

M101:

SetUserLED (nnnn, 0)    ' Led off


or you can use both in one macro:


M100:

If GetUserLED (nnnn) then       ' UserLED on?
     SetUserLED (nnnn,0)          ' then turn it off
else
     SetUserLED (nnnn, 1)         ' ..or turn it on...
end if


Thats will toggle the status of your LED....

Copy this macro into your folder matching your profile.


Best regards,


Wolfram

Logged
Darc
Active Member

Offline Offline

Posts: 177


View Profile
« Reply #2 on: February 19, 2007, 07:00:09 PM »

Thanks Wolfram, on my screen set I have 15 buttons and an LED for each button/program, how do I set each LED to run for one individual program only?
Does that mean I need to have 15 different M codes?
Also do I just save each M code as follows: M100.m1s,  M101.m1s, M102.m1s, M103.m1s, M104.m1s, etc etc?
Sorry one more thing, with this code you wrote.

SetUserLED (nnnn, 1)   ' Led on
(How do I link this to a particular LED?)

Also on another topic, I've searched the forums and looked in Mach3 but I can't seem to work out how to get a DRO and a button that runs a program to interact.
I think I'm close, I want to have a DRO that you can put a measurement into and when you press a button it will use this measurement in the program, this is what I have.
Create a DRO, I assigned it to DIAMETER OF CURRENT TOOL (which I think is OEM code 105), should I select DIAMETER OF CURRENT TOOL from the drop down or should I enter the OEM code 105?

Create a button and assign VB code to it as follows:

Material = GetOEMDRO (105)
CODE "#1=Material"     ;In theory if 20 is entered into the DRO, Material should =20
CODE "G90 G55 G21 
CODE "G00 Y[#1*2]    ;Rapid to Y40
CODE "G01 Y#1 F100  ;Linear travel to Y20
CODE "G00 Y[#1*2]    ;Rapid back to Y40
CODE "M30"

What am I doing wrong?
« Last Edit: February 20, 2007, 09:25:10 PM by Darc » Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #3 on: February 20, 2007, 07:53:12 PM »

Not sure what you are wanting, but, you could make yourself a Wizard that would post your code for you, by intering your info and moves into DROs.
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
cncstep
Active Member

Offline Offline

Posts: 21




View Profile WWW
« Reply #4 on: April 13, 2009, 12:20:31 PM »

Thanks was useful Smiley
Logged

Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!