Hello Guest it is April 27, 2024, 12:54:36 PM

Author Topic: Mach4 Signal Tower script  (Read 671 times)

0 Members and 1 Guest are viewing this topic.

Mach4 Signal Tower script
« on: June 19, 2023, 10:46:44 AM »
Hi all,

I'm pretty new with Mach4 and I am struggling to find any guidance, how to implement Signal Tower.
I am familiar with screen load script and PLC script. I guess blinking LED will require to use wxTimer somehow.
I tried simple thing as assigning dummy LED icon to certain machine states, but I think the output will be hardwired to one machine state only.

I will take advice on signal light states.
I would suggest:

Blinking Red - Estop condition
Blinking Yellow - Tool change
Static Green - Gcode running
blinking green - Gcode finished

Thanks!
Re: Mach4 Signal Tower script
« Reply #1 on: June 19, 2023, 04:35:33 PM »
Hi,
no need for a timer or anything like it.

If you add a LED to the screen, you can set properties like size, color and blink rate.
You can also associate both inputs and outputs. If you have a blinking LED you can attach that to an output via the ESS and have a blinking tower light.
This is just using what Mach4 already has, there should be no need to invent anything new, just use whats already there.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach4 Signal Tower script
« Reply #2 on: June 20, 2023, 01:19:18 AM »
ok, I can make blinking amber LED which is bound to output signal "Feed hold".
But I don't know, how to attach it to physical output now in ESS, lets say Output #30.
Re: Mach4 Signal Tower script
« Reply #3 on: June 20, 2023, 06:23:47 PM »
Hi,
it's not to bad. Its a three step procoess.

The first step is to associate your on-screen LED with an output with the drop down list, you've picked output#30. See the pic....one of the properties of a Mach4 LED is to be
assigned to an output.

Next step is to open the ESS plugin configurator and find a spare output pin, in this case I chose port 1, pin 14 as its spare on my desktop PC. Note I've given it an alias.

Last step is to associate the output, in this case output#30, with that pin.

Now  port1 pin14 of the ESS will reflect the status of your onscreen LED.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach4 Signal Tower script
« Reply #4 on: June 21, 2023, 03:02:09 AM »
As far as I know you can’t use the LED to control the output. The Output controls the state of the LED. Therefore wxTimer can be used or an easier option will be using the PMC if you’re familiar with ladder logic
Re: Mach4 Signal Tower script
« Reply #5 on: June 21, 2023, 07:53:11 AM »
Hi,
it's not to bad. Its a three step procoess.

The first step is to associate your on-screen LED with an output with the drop down list, you've picked output#30. See the pic....one of the properties of a Mach4 LED is to be
assigned to an output.

Next step is to open the ESS plugin configurator and find a spare output pin, in this case I chose port 1, pin 14 as its spare on my desktop PC. Note I've given it an alias.

Last step is to associate the output, in this case output#30, with that pin.

Now  port1 pin14 of the ESS will reflect the status of your onscreen LED.

Craig

That is exactly what I was thinking, but I can not assign LED to a machine state like Feed Hold, which is in outputs and to Output #30 simultaneously. I understand that what you described would take care of blinking, but I still need some code to make the dummy onscreen LED active at  certain machine states. Thats why I was asking how to make signal tower working.

Maybe in PLC script make an IF, that will activate dummy onscreen LED?
Re: Mach4 Signal Tower script
« Reply #6 on: June 21, 2023, 07:55:22 AM »
As far as I know you can’t use the LED to control the output. The Output controls the state of the LED. Therefore wxTimer can be used or an easier option will be using the PMC if you’re familiar with ladder logic

Thank you very much for your input!
Can you please share an example script for one LED? (and where to put it)
Re: Mach4 Signal Tower script
« Reply #7 on: June 21, 2023, 04:47:31 PM »
Hi,
I have just been experimenting now that I am at work, and Swifty is correct an LED will not drive an output.

You could use a toggle button, because a toggle button can and does drive an output. Even with the button blinking however the output does not blink,
so the blinking is a property of the toggle button display, the underlying signal is just ON or OFF, it does not blink.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach4 Signal Tower script
« Reply #8 on: June 22, 2023, 03:20:12 PM »
Thank you very much for your input!
Can you please share an example script for one LED? (and where to put it)

I have attached an example I did in the PMC. Currently it is configured to turn on Output2 when Tool Change is active, but if you go into the PMC editor and double click 'FYellowLight' you can change it to whatever you have it mapped to.

To get it to work:
  • Copy the file into C:\Mach4Hobby\PMC.
  • Access the PMC editor within Mach4 by going to Configure>PMC. Then load the .pmc file through the File>Open menu.
  • After any changes you need to generate the lua code.
  • Within the PMC editor go to Settings>Code Generator and select 'Lua Code'.
  • Then go to Generate>Generate as and save the lua file.
  • To load the file you need to go into the screen editor, select the top level item in the tree, go to the Properties tab and at the bottom is PMC Objects where you can select the file just generated.

Or just watch this video which I found after typing all that out https://www.youtube.com/watch?v=jVhH9qyjjf0