how to change motor spin directions?
26 Mar 2016 05:24 - 26 Mar 2016 05:25 #72170
by famus
Replied by famus on topic how to change motor spin directions?
Yes, thank you! I had that working by:
net p-scale stepgen.0.velocity-cmd <= GUI.hal_spinbutton1-f
However, I could not input a negative number to reverse velocity direction.
I fixed the previous problem of "GUI.checkbox_ReverseDir" is not a pin, I changed the checkbox to a HAL_toggle button and that was a pin. But still can't change as "parport.0.pin-07-out-invert" is not a pin but a parameter as you said earlier.
Still trying ...
net p-scale stepgen.0.velocity-cmd <= GUI.hal_spinbutton1-f
However, I could not input a negative number to reverse velocity direction.
I fixed the previous problem of "GUI.checkbox_ReverseDir" is not a pin, I changed the checkbox to a HAL_toggle button and that was a pin. But still can't change as "parport.0.pin-07-out-invert" is not a pin but a parameter as you said earlier.
Still trying ...
Last edit: 26 Mar 2016 05:25 by famus.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Away
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
26 Mar 2016 17:18 #72187
by Todd Zuercher
Replied by Todd Zuercher on topic how to change motor spin directions?
I would think the most elegant solution would be to figure out why you can't get a negative number and fix that
.
But you could create a series of hal commands that could convert your number you are sending to a negative number. This seems like a rather tortured hack but,here goes. Connect your float (absolut velocity) value to a mult2, (other mult2 input would be -1), then connect your original float value to one float input of a mux2, and the other float input of the mux2 to the product of the sum2. Then the input bit of the mux2 you would use to change your direction.
.
But you could create a series of hal commands that could convert your number you are sending to a negative number. This seems like a rather tortured hack but,here goes. Connect your float (absolut velocity) value to a mult2, (other mult2 input would be -1), then connect your original float value to one float input of a mux2, and the other float input of the mux2 to the product of the sum2. Then the input bit of the mux2 you would use to change your direction.
Please Log in or Create an account to join the conversation.
28 Mar 2016 06:20 #72235
by famus
Replied by famus on topic how to change motor spin directions?
Yes. that's an idea! However, I should know why the float spinbox wouldn't take a negative number. I tried:
setp stepgen.0.velocity-cmd -2
and it worked to reverse direction. I should read up GladeVCP how to set range.
Thank you!
setp stepgen.0.velocity-cmd -2
and it worked to reverse direction. I should read up GladeVCP how to set range.
Thank you!
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Away
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
28 Mar 2016 12:49 - 28 Mar 2016 14:07 #72243
by Todd Zuercher
Replied by Todd Zuercher on topic how to change motor spin directions?
To set up a spin-button you have to have an Adjustment widget associated with the spin-button and that is where you set the range of values that can be output by the spin-button.
So if you are using an existing example Gladevcp you will need to open it in the Glade editor, open the adjustment widget associated with your spin-button, and change the minimum value there to a negative number (instead of the default of 0).
So if you are using an existing example Gladevcp you will need to open it in the Glade editor, open the adjustment widget associated with your spin-button, and change the minimum value there to a negative number (instead of the default of 0).
Last edit: 28 Mar 2016 14:07 by Todd Zuercher.
Please Log in or Create an account to join the conversation.
Time to create page: 0.201 seconds