We would like to have a motor run one direction on a button press and the opposite direction on release. How does one program this? Thanks.
So you want it to run one way the whole time when the button is being held and the other way the whole time the button is not held?
If that’s what you want try the “Select” node. It’s in the Comparisons palette I believe, and it will select the top input and pass it through if the middle input is true and the bottom input if the middle input is false. You would put the button as the middle input and your desired motor speeds as the top and bottom.
If you want to run the motor in a certain direction for a certain period of time on button press and release that becomes a little bit trickier.
Is it possible to have a singular motor subject to the control of more than one button? Like, could the press of one button turn it one direction and the press of another turn it the other way? If so, how is that done?
Yes, you need a case structure with 3 cases: case 0 with nothing, case 1 with forward motor, and case 2 with a backwards motor.
You merge the signal of the two buttons using a boolean array. Then you convert the boolean array value to a number using something in the boolean palette.
Yes, this can be done. The way Mehmed posted is one option. I have attached a picture of another way you can do it.
You guys are the best!
We’ll give these a try and see what happens. Thanks!