- Posts: 3410
- Thank you received: 0
Toggle Flood with One Button
15 years 4 months ago #10494
by BigJohnT
Toggle Flood with One Button was created by BigJohnT
This example shows you how to toggle the flood coolant with a single button. It can be a physical button or a pyvcp button or both if you add and or2 to use either button. In this example I used a pyvcp button.
The image shows the basic connections. It breaks down like this:
If the button is pushed AND the machine is on then input to toggle is on.
When toggle input is on change the output state
When toggle out is on toggle2nist input is on.
When toggle2nist in changes states
If coolant is on output off
If coolant is not on output on
John
Code:
# Flood Coolant Toggle
net coolant-btn and2.0.in0 <= pyvcp.coolant
net coolant-ok and2.0.in1 <= halui.machine.is-on
net coolant-request toggle.0.in <= and2.0.out
net coolant-toggle toggle2nist.0.in <= toggle.0.out
net coolant-is-on toggle2nist.0.is-on <= halui.flood.is-on
net coolant-on halui.flood.on <= toggle2nist.0.on
net coolant-off halui.flood.off <= toggle2nist.0.off
The image shows the basic connections. It breaks down like this:
If the button is pushed AND the machine is on then input to toggle is on.
When toggle input is on change the output state
When toggle out is on toggle2nist input is on.
When toggle2nist in changes states
If coolant is on output off
If coolant is not on output on
John
Please Log in to join the conversation.
- piasdom
- New Member
-
Less
More
- Thank you received: 0
15 years 4 months ago #10524
by piasdom
Replied by piasdom on topic Re:Toggle Flood with One Button
now dats some good xplaneing.
gonna see if it can use it on my on/off - run/stop pyvcp button.
Great Job ! T'anks !
p.s. edited - your toggle(in file, not pic) are mismatched?
gonna see if it can use it on my on/off - run/stop pyvcp button.
Great Job ! T'anks !
p.s. edited - your toggle(in file, not pic) are mismatched?
Please Log in to join the conversation.
15 years 4 months ago #10526
by BigJohnT
Replied by BigJohnT on topic Re:Toggle Flood with One Button
piasdom wrote:
What do you mean?
John
p.s. edited - your toggle(in file, not pic) are mismatched?
What do you mean?
John
Please Log in to join the conversation.
- piasdom
- New Member
-
Less
More
- Thank you received: 0
15 years 4 months ago #10528
by piasdom
Replied by piasdom on topic Re:Toggle Flood with One Button
well, i got the below to work but there's a slight delay
for my led to change. but other then that, it works.
THANKS John !
will be testing to see it gets out of sync anywhere.
#power on/off
net power-btn and2.11.in0 <= pyvcp.on-off
net power-ok and2.11.in1 <= halui.program.is-idle
net power-request toggle.4.in <= and2.11.out
net power-toggle toggle2nist.2.in <= toggle.4.out
net power-is-on toggle2nist.2.is-on <= halui.machine.is-on
net power-on halui.machine.on <= toggle2nist.2.on
net power-off halui.machine.off <= toggle2nist.2.off
for my led to change. but other then that, it works.
THANKS John !
will be testing to see it gets out of sync anywhere.
#power on/off
net power-btn and2.11.in0 <= pyvcp.on-off
net power-ok and2.11.in1 <= halui.program.is-idle
net power-request toggle.4.in <= and2.11.out
net power-toggle toggle2nist.2.in <= toggle.4.out
net power-is-on toggle2nist.2.is-on <= halui.machine.is-on
net power-on halui.machine.on <= toggle2nist.2.on
net power-off halui.machine.off <= toggle2nist.2.off
Please Log in to join the conversation.
- piasdom
- New Member
-
Less
More
- Thank you received: 0
15 years 4 months ago #10529
by piasdom
Replied by piasdom on topic Re:Toggle Flood with One Button
shouldn't toggle be toggle.0.in and toggle.0.out ?
yours:
net coolant-request toggle.0.in <= and2.0.out
net coolant-toggle toggle2nist.0.in <= toggle.1.out
yours:
net coolant-request toggle.0.in <= and2.0.out
net coolant-toggle toggle2nist.0.in <= toggle.1.out
Please Log in to join the conversation.
15 years 4 months ago #10530
by BigJohnT
Replied by BigJohnT on topic Re:Toggle Flood with One Button
Yes, that was a good catch on that typo. Sometimes you can't see the forest for the trees... or something like that.
Thanks
John
Thanks
John
Please Log in to join the conversation.
15 years 4 months ago #10531
by BigJohnT
Replied by BigJohnT on topic Re:Toggle Flood with One Button
Not sure that I would use halui.program.is-idle for your power on/off as it is true even if the e-stop is active which means you can't turn the power on in that state. I would use halui.estop.is-activated with a not to invert the state of the pin as part of my and2.
John
John
Please Log in to join the conversation.
- piasdom
- New Member
-
Less
More
- Thank you received: 0
15 years 4 months ago #10532
by piasdom
Replied by piasdom on topic Re:Toggle Flood with One Button
no biggie, i know it's correct in your working file or it wouldn't work
Please Log in to join the conversation.
- piasdom
- New Member
-
Less
More
- Thank you received: 0
15 years 4 months ago #10533
by piasdom
Replied by piasdom on topic Re:Toggle Flood with One Button
BigJohnT wrote:
cool. i'll try that.
Not sure that I would use halui.program.is-idle for your power on/off as it is true even if the e-stop is active which means you can't turn the power on in that state. I would use halui.estop.is-activated with a not to invert the state of the pin as part of my and2.
John
cool. i'll try that.
Please Log in to join the conversation.
- piasdom
- New Member
-
Less
More
- Thank you received: 0
15 years 4 months ago #10534
by piasdom
Replied by piasdom on topic Re:Toggle Flood with One Button
could i use toggle instead. not.0 slows emc a lot
and what about using iocontrol.0.user-request-enable
to change state with toggle ?
and what about using iocontrol.0.user-request-enable
to change state with toggle ?
Please Log in to join the conversation.
Time to create page: 0.067 seconds
