Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: plasmashine on March 17, 2018, 09:33:27 AM

Title: Adding outputs controlled by custom buttons
Post by: plasmashine on March 17, 2018, 09:33:27 AM
My first post here.

I have built a  Plasma table from scratch which works well.

I am now adding some extra functionality to it.

It uses a UC400ETH notion controller.


I wish to add a custom button to my mach screen.

I am using the spindle relay on my breakout board to trigger my plasma, I would like that when the custom button is clicked another output operates whenever the spindle does.

Reason for this,  I have mounted a visible laser to the plasma torch and i want the laser to operate instead of the plasma cutter, giving a visual 'Dry run'.

I know I can do this with a mechanical switch but I would like to use Mach3 to control it.

I have used Machscreen to add a button and then I assume I need to write a brain or some VB to complete the task.

If someone could point me in the right direction I'd very much appreciate it.
Title: Re: Adding outputs controlled by custom buttons
Post by: TPS on March 17, 2018, 10:16:19 AM
declare Standard code of your button as 34 (execute Basic stript)

then einter this vb code to script


If IsActive(OUTPUT1) Then
  DeactivateSignal(OUTPUT1)
Else
  ActivateSignal(OUTPUT1)
End If
Title: Re: Adding outputs controlled by custom buttons
Post by: plasmashine on March 17, 2018, 11:24:00 AM
Thanks for the prompt reply.


Title: Re: Adding outputs controlled by custom buttons
Post by: plasmashine on March 18, 2018, 01:22:52 PM
I tried this with some success, I could turn  output 3 on but it didn't turn off again.
Output 1 and 6 did nothing.

What am I missing?
Title: Re: Adding outputs controlled by custom buttons
Post by: TPS on March 19, 2018, 05:12:38 AM
sorry Little mistake, right code:

If IsOutputActive(OUTPUT1) Then
  DeactivateSignal(OUTPUT1)
Else
  ActivateSignal(OUTPUT1)
End If

it will only work for Outputs witch are enabled in Config -> Ports&Pins -> Outputs
Title: Re: Adding outputs controlled by custom buttons
Post by: plasmashine on March 19, 2018, 08:02:39 AM
Thanks Again