Page 1 of 2

buttons to turn on the output when the machine is running

PostPosted: Tue Jan 04, 2022 4:56 pm
by fixebr
Greetings!
I made 2 buttons to turn on the additional equipment of the machine - a vacuum cleaner and a vacuum pump (the output turns on a 1A relay, and the relay turns on a high power magnetic starter). They work fine - I can turn the vacuum on and off, but only until I start running the gcode. What do I need to do to get my buttons to work during milling, just like the blow off or coolant buttons?
My button macro:
Code: Select all
bool buttonstate = AS3.Getbuttonstate(20501);
if (!buttonstate)
    {
   AS3.Switchbutton(true,20501);   
   exec.Setoutpin(2, 16);
    }
else
    {
    AS3.Switchbutton(false,20501);
    exec.Clroutpin(2, 16);
    }

Re: buttons to turn on the output when the machine is runnin

PostPosted: Wed Jan 05, 2022 8:41 am
by cseyler
Hi,

I made this plugin for this purpose. As the macros doesn't work either during an operation is running, or in the reset state, the plugin monitors toggle buttons to switch leds

The buttons have to be "toggle type" and having an ID between 990 and 999. They toggle corresponding leds (990 to 999).

You don't have to "physically" add the led to the screenset

So, from that point, you can "link" a specific output to a led (990 to 999) in the settings->I/O trigger->O.Trig. panel.

If you need to control that from a macro, you can either switch the button(990 to 999) in the macro, or switch the correponding LEDs. The plugin will autoimatically toggle the button state accroding to the led state.

And then, you can also put a led on your screenset to have a visual feedback on the led

Re: buttons to turn on the output when the machine is runnin

PostPosted: Wed Jan 05, 2022 10:02 am
by cncdrive
You could write a macroloop, that runs always in the background in a loop/cycle.

Re: buttons to turn on the output when the machine is runnin

PostPosted: Wed Jan 05, 2022 3:45 pm
by fixebr
cseyler wrote:plugin

Sorry, but after adding your plugin, the program stops starting. I had to disable the plugin in the configuration file and delete the dll from the folder to get it working again. Perhaps you are using a different version of UCCNC? I have a 1.2113.
cncdrive wrote:You could write a macroloop, that runs always in the background in a loop/cycle.

Sorry, do you have any code examples for macroloop? I'm not that good at writing code to figure out how to do it from scratch. Thank you!

Re: buttons to turn on the output when the machine is runnin

PostPosted: Wed Jan 05, 2022 6:39 pm
by cncdrive
My collegue "dezsoe" will help you with the code, he will be back from his holidays on Friday.

Re: buttons to turn on the output when the machine is runnin

PostPosted: Thu Jan 06, 2022 8:15 am
by cseyler
fixebr wrote:Sorry, but after adding your plugin, the program stops starting. I had to disable the plugin in the configuration file and delete the dll from the folder to get it working again. Perhaps you are using a different version of UCCNC? I have a 1.2113.


That's strange. I use the latest beta version 1.2115

Re: buttons to turn on the output when the machine is runnin

PostPosted: Thu Jan 06, 2022 12:41 pm
by dezsoe
Hi cseyler,

Please, do not use buttons that are reserved (885-999), because that will conflict with later releases. (In fact, many of them are already used in early alpha plugins that are not released yet.) I received your PM and I'll reply in some days.

Hi fixebr,

I'll be back in some days with a plugin for you.

Re: buttons to turn on the output when the machine is runnin

PostPosted: Fri Jan 07, 2022 6:57 pm
by cseyler
dezsoe wrote:Hi cseyler,
Please, do not use buttons that are reserved (885-999), because that will conflict with later releases. (In fact, many of them are already used in early alpha plugins that are not released yet.) I received your PM and I'll reply in some days.


Thanks, I will update my plugin to address a free range of button number

Re: buttons to turn on the output when the machine is runnin

PostPosted: Fri Jan 21, 2022 2:49 pm
by fixebr
cncdrive wrote:My collegue "dezsoe" will help you with the code, he will be back from his holidays on Friday.

Hello.
I understand that this task is very trivial, but I can not find solutions through the search on the forum. Did no one asked such a question before and you do not have a ready-made solution?

Re: buttons to turn on the output when the machine is runnin

PostPosted: Mon Jan 24, 2022 7:19 pm
by dezsoe
Hi fixebr,

Sorry, I forgot to reply you. Here is a small (really small!) plugin for you. I attached the whole C# project. You can find the .dll in the SwitchOutput\SwitchOutput\bin\Release folder. Copy the .dll into the Plugins folder under UCCNC then enable the plugin. In your profile you have to set the buttonnumber, port, pin and activelow per button:

Code: Select all
[SwitchOutput]
Button1=55555,3,17,False

The plugin will search for Button1 to Button10, but you don't have to give all of them, only that you need. The plugin turns the button on and off, so use bi-state buttons.