Machsupport Forum
Mach Discussion => Mach Screens => Screen designer tips and tutorials => Topic started by: Katoh on July 14, 2017, 09:26:01 PM
-
Hi Friends
This may seem like a pretty simple question but I have forgotten how to do it.
I am using screen4 to edit the lathe screen I have added a C axis position and zero button to the screens but need to add to anther 2 buttons, these buttons control certain aspects of the servo motor I use as the spindle. One being "Alarm Off" the other is "Servo Disable". What I want is when the button is pressed it simply activates an output in ports in pins, that’s it! Just not certain how to do it.
Thanks
-
ActivateSignal(Output#) ' # is the output as defined in configuration
RICH
-
Thanks Rich
Got it!
Just one thing can I switch it off again with the same button?
i.e hit button once it turns on then hit the same button it turns off?
Thanks
-
Add a User LED to the screen.
When you click the button, check the state of the LED.
If the LED is off, turn it on, and activate the output.
If the LED is on, turn it off, and de-activate the output.
-
Sorry now I’m a little confused.
What I have done from scratch might give you an idea where Im most likely going wrong.
In screen4 I have made a button that says Servo On / Servo Off, I have ticked in its properties use VB script. Now I go into mach and open VB button editor and open that button, In the editor, line one reads ActivateSignal(output1) line two reads deActivateSignal(output1). but it just doesn’t work.
Made two buttons one for off and one for on, that works but its painful, screen4 is the worst program I think I have ever used, You set it up then open mach and things are not where they should be takes hours going back and forth to get things in the correct position.
Thanks for the replies
-
Screen 4 works perfectly, and is my preferred editor. But it works best in XP, and if the entire screen fits in the window without scroll bars. You may find MachScreen more to your liking.
Add an LED with OEM code 1500, and you're code should look like this:
If GetOEMLED(1500) Then
SetUserLED(1500,0)
deActivateSignal(output1)
else
SetUserLED(1500,1)
ActivateSignal(output1)
end if
-
Screen 4 works perfectly, and is my preferred editor. But it works best in XP, and if the entire screen fits in the window without scroll bars.
Now that explains it all, I’m using windows 7 and yes there are scroll bars both left to right and top to bottom. I do have an old system running XP I might try it on thay one as the win7 machine is simple painful.
Thanks for that code I definitely will try that.