buttons to turn on the output when the machine is running

If you have a question about the software please ask it here.

buttons to turn on the output when the machine is running

Postby fixebr » Tue Jan 04, 2022 4:56 pm

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);
    }
My English is bad, so you're reading machine translation results. Alas.
User avatar
fixebr
 
Posts: 40
Joined: Thu Dec 30, 2021 8:30 pm
Location: Russia, Moscow

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

Postby cseyler » Wed Jan 05, 2022 8:41 am

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
Attachments
CreafinityShaperPlugin.dll
(24.5 KiB) Downloaded 370 times
cseyler
 
Posts: 71
Joined: Tue May 25, 2021 11:27 am

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

Postby cncdrive » Wed Jan 05, 2022 10:02 am

You could write a macroloop, that runs always in the background in a loop/cycle.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

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

Postby fixebr » Wed Jan 05, 2022 3:45 pm

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!
My English is bad, so you're reading machine translation results. Alas.
User avatar
fixebr
 
Posts: 40
Joined: Thu Dec 30, 2021 8:30 pm
Location: Russia, Moscow

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

Postby cncdrive » Wed Jan 05, 2022 6:39 pm

My collegue "dezsoe" will help you with the code, he will be back from his holidays on Friday.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

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

Postby cseyler » Thu Jan 06, 2022 8:15 am

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
cseyler
 
Posts: 71
Joined: Tue May 25, 2021 11:27 am

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

Postby dezsoe » Thu Jan 06, 2022 12:41 pm

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.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

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

Postby cseyler » Fri Jan 07, 2022 6:57 pm

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
cseyler
 
Posts: 71
Joined: Tue May 25, 2021 11:27 am

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

Postby fixebr » Fri Jan 21, 2022 2:49 pm

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?
My English is bad, so you're reading machine translation results. Alas.
User avatar
fixebr
 
Posts: 40
Joined: Thu Dec 30, 2021 8:30 pm
Location: Russia, Moscow

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

Postby dezsoe » Mon Jan 24, 2022 7:19 pm

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.
Attachments
SwitchOutput.zip
(20.73 KiB) Downloaded 412 times
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Next

Return to Ask a question from support here

Who is online

Users browsing this forum: Google [Bot] and 30 guests

cron