one button multiple functions

More
18 Dec 2011 08:40 #15796 by Rick G

The component may need a delay built in to prevent cycling through the states, if the button is not just pressed momentarily.
If that is the case let me know and I will devise something.


For something like that I just use "oneshot"
www.linuxcnc.org/docview/html/man/man9/oneshot.9.html

Rick G

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

More
18 Dec 2011 10:20 #15801 by fabworx
awesome i hadnt found any thing in the docs on multiswitch thanx to you guys thank you very much

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

More
18 Dec 2011 11:01 #15804 by ArcEye
Hi again

I have amended the component to include a flag which prevents another toggle occurring until the switch has been released.
Thus will latch on a given output and prevent cycling on the same signal.

I have also cleaned up the logic as it used to reset the pins each time it was called even if they had not changed.

I have posted in the Hal Examples section for anyone who wants it.

www.linuxcnc.org/index.php/english/compo...id=47&id=15803#15803

You could achieve exactly the same thing using the updown and select8 components Andy highlighted and the oneshot component Rick pointed to without writing a new component. This just does it all in one component.

Emc is very flexible

regards

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

More
19 Dec 2011 22:40 #15874 by fabworx
thank you arceye however i cant seem to locate multiswitch i dont have vanilla i have lucid installed from the live cd here if it is only in the vanilla version how would i go about obtaining it. thank you again

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

More
19 Dec 2011 23:30 #15877 by andypugh
fabworx wrote:

thank you arceye however i cant seem to locate multiswitch

That is because it isn't in any released version of EMC2 yet.

You need to use comp to compile/install it on you system from the source code posted in this thread:
www.linuxcnc.org/index.php/english/compo...id=47&id=15803#15803
Using the process described here in section 1.12
linuxcnc.org/docs/html/hal_comp.html

(welcome to Open Source. where if a program doesn't do what you want, you change it.)

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

More
20 Dec 2011 08:03 #15881 by ArcEye

thank you arceye however i cant seem to locate multiswitch i dont have vanilla i have lucid installed from the live cd here if it is only in the vanilla version how would i go about obtaining it. thank you again

Vanilla is just used to denote a bog standard plain item (with no added flavourings!) not to be confused with the stupid names Ubuntu calls its releases!

It is worth taking the time to learn how to compile things and connect up components in hal, takes you from merely using EMC via a gui, to actually understanding some of what goes on.

regards

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

More
20 Dec 2011 08:27 #15884 by fabworx
lol thank you for the explanation i get it now. ive only been using linux for about 8 mo. and quite frankly 4 of those if been traveling for work. linux is only on the pc in the mill so the learning curve has been steep, but i think im catching on. ive learned so much just from these past few days its crazy. i really appreciate all of the help everyone here has contributed.

i have one problem ive run into. with the multiswitch in your example on this thread you have the multiswitch.0.toggle connected to what i would believe is a input from the io and the actual comp file says it should be connected to an output or am i backwards. if i understand it correctly the toggle is what switches the states and should connect to the physical momentary button. right? if im wrong how would i hook up my button on the pendent (momentary) to the toggle if it is connected to an output. thanx again
sincerly
denny reed

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

More
20 Dec 2011 09:07 #15886 by ArcEye
Hi

The toggle pin was originally created as I/O because the component set it back to false after reading it, so it had to be addressable both ways.
In the later rewrite, this didn't need to happen but I forgot to change the pin type to input!

You are correct, multiswitch.0.toggle is connected to a switch.
It now does not matter if the switch is momentary, because it latches until the switch is released and depressed again.
However a momentary (press) switch is exactly the type of switch you would probably use if you want to toggle through several states.

regards

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

More
20 Dec 2011 09:12 #15888 by fabworx
I must have the old one cause I get an error when starting emc. How should I go about fixing it thanx again

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

More
20 Dec 2011 09:22 #15889 by ArcEye

I get an error when starting emc

You will need to post the error, having the pin IO should not cause an error when just connecting to a switch.

If you want to eliminate that as an error source, change io to in in gedit, save it and run comp --install multiswitch.comp again then retry

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

Time to create page: 0.182 seconds
Powered by Kunena Forum