Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: DAS on October 13, 2015, 11:58:08 AM
-
Hi all
I think this has been asked before but here goes again. I would like to set a hotkey to activate an output relay. I would like to replace or reuse one of the existing screen buttons re name it and have it activate an output relay only while the key or button is pushed. I have already done the button in screen 4 now I need to know how to program it. I assume it needs a code installed in VB Script???? That's where I am stuck. code output active and output deactivate where does the code go and how do find where I put it and make it work my output pin.
I have a keyboard full of keys to use do not really want to install a bank of switches
HELP PLEASE DAS
-
Looks like alt C is tied to the coolant so, could you not setup your output to the coolant and use that?
-
Hi All
the 3 available pre programmed outputs coolant, mist and spindle ccw buttons are all in use. still need a couple more.
Thanks DAS
-
Hi Das,
put this little script into the button
'GetOEMLed(77) -> Output4
'GetOEMLed(78) -> Output5
'GetOEMLed(79) -> Output6
If GetOEMLed(79) Then
DeActivateSignal(Output6)
Else
ActivateSignal(Output6)
End If
but dont forget to activate the output in port's & pin's
Thomas
-
Thanks TPS The code works great turns it on and off I also need a momentary contact. do you have a code for that.
really appreciate the info I can build a machine but programming codes are beyond me.
Thanks DAS
-
Hello DAS,
as far i know, it is not possible to switch a output only while the key is pressed.
the macro is only trigged once when the key is pressed, not when the key ist released.
for the moment i know no way to realise this.
Thomas
-
I DID find a code somewhere that was for on and off but of course cant find it when you need it.Is it possible to have a code input 4 on and then a delay of around 5 seconds and then turn off without pressing the button again??
Thanks DAS
-
Hi All Sorry output 4 not input 4
DAS
-
OK,
put this code in macropump script:
If GetOEMLed(77) then ' Output4 is on
If Timer - GetOEMDRO(1500) > 5 then
DeActivateSignal(Output4)
End if
Else
SetOEMDRO(1500,Timer)
End If
make sure macropump is enabled in general config
restart Mach
Thomas
-
Hi TPS tried the code even on 2 machines it did nothing. what am I doing wrong.
DAS
-
If using an on screen button and putting VB in it then all you should need in the button is
ActivateSignal(OutPut4)
Sleep 5000
DeActivateSignal (OutPut4)
Hood
-
Thanks Hood and everyone
This question was asked many times on the forum and I never found an answer to it.
Thanks DAS