Hello Guest it is March 29, 2024, 01:39:42 AM

Author Topic: HOTKEY TO OUTPUT RELAY  (Read 5654 times)

0 Members and 1 Guest are viewing this topic.

Offline DAS

*
  •  21 21
    • View Profile
HOTKEY TO OUTPUT RELAY
« 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
Re: HOTKEY TO OUTPUT RELAY
« Reply #1 on: October 14, 2015, 07:42:09 AM »
Looks like alt C is tied to the coolant so, could you not setup your output to the coolant and use that?

Offline DAS

*
  •  21 21
    • View Profile
Re: HOTKEY TO OUTPUT RELAY
« Reply #2 on: October 14, 2015, 08:28:41 AM »
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

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: HOTKEY TO OUTPUT RELAY
« Reply #3 on: October 15, 2015, 03:52:32 AM »
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
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline DAS

*
  •  21 21
    • View Profile
Re: HOTKEY TO OUTPUT RELAY
« Reply #4 on: October 15, 2015, 08:52:18 AM »
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

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: HOTKEY TO OUTPUT RELAY
« Reply #5 on: October 15, 2015, 08:58:56 AM »
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
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline DAS

*
  •  21 21
    • View Profile
Re: HOTKEY TO OUTPUT RELAY
« Reply #6 on: October 15, 2015, 11:16:23 AM »
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

Offline DAS

*
  •  21 21
    • View Profile
Re: HOTKEY TO OUTPUT RELAY
« Reply #7 on: October 15, 2015, 01:31:01 PM »
Hi All Sorry output 4 not input 4

DAS

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: HOTKEY TO OUTPUT RELAY
« Reply #8 on: October 16, 2015, 03:22:59 AM »
OK,

put this code in macropump script:
Code: [Select]
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
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline DAS

*
  •  21 21
    • View Profile
Re: HOTKEY TO OUTPUT RELAY
« Reply #9 on: October 16, 2015, 01:15:11 PM »
Hi TPS  tried the code even on 2 machines   it did nothing. what am I doing wrong.

DAS