run/pause/restore button

More
26 Apr 2017 19:29 - 27 Apr 2017 17:41 #92165 by caio
hi everyboby,
i would like to add an on/off button (on the same button) on my joypad.
i tried the example in this page (flood button)
wiki.linuxcnc.org/cgi-bin/wiki.pl?Using_...ove_Your_CNC_Machine
but when i press the button it switch on-off continuosly until button is released.
if i press it very very shortly, it work, but is a little dangerous for the machine.
i believe i need a flipflop, but i can't find the way to use it.
do you have some suggestion?

thanks
Last edit: 27 Apr 2017 17:41 by caio.

Please Log in or Create an account to join the conversation.

More
26 Apr 2017 20:05 #92166 by Todd Zuercher
I think you might want to use the Toggle2NIST and if you still have a problem with it going on and off, run the input through an edge detector.

Please Log in or Create an account to join the conversation.

More
27 Apr 2017 11:36 #92194 by caio
Replied by caio on topic double function button
i think i will need both.
thanks

Please Log in or Create an account to join the conversation.

More
27 Apr 2017 17:49 #92224 by caio
Replied by caio on topic double function button
i like to share my code for run-pause-resume button on joypad:
##### BUTTON START-PAUSE-RESUME
loadrt and2 count=3
loadrt not count=2
loadrt edge count=1

setp edge.0.in-edge FALSE
setp edge.0.out-width-ns 100000000
net runPause0 input.0.btn-base4 => edge.0.in
net runPause1 edge.0.out => and2.0.in0
net runPause1 edge.0.out => and2.2.in0
net runPause1 edge.0.out => and2.3.in1
net runPause2 halui.program.is-running => not.0.in
net runPause2 halui.program.is-running => and2.2.in1
net runPause3 not.0.out => and2.0.in1
net runPause4 and2.0.out => and2.1.in1
net runPause5 and2.1.out => halui.mode.auto
net runPause5 and2.1.out => halui.program.run
net runPause6 and2.2.out => halui.program.pause
net runPause7 halui.program.is-paused => not.1.in
net runPause7 halui.program.is-paused => and2.3.in0
net runPause8 and2.3.out => halui.program.resume
net runPause9 not.1.out => and2.1.in0
addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf not.0 servo-thread
addf not.1 servo-thread
addf edge.0 servo-thread
#####

hoping it can help someone.

Please Log in or Create an account to join the conversation.

Time to create page: 0.217 seconds
Powered by Kunena Forum