one button multiple functions
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.
Please Log in or Create an account to join the conversation.
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.
Please Log in or Create an account to join the conversation.
That is because it isn't in any released version of EMC2 yet.thank you arceye however i cant seem to locate multiswitch
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.
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!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
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.
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.
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.
Please Log in or Create an account to join the conversation.
You will need to post the error, having the pin IO should not cause an error when just connecting to a switch.I get an error when starting emc
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.