I know there is a thread on this already and am having trouble finding it again so I am making this topic. How do you make it so you can have two different buttons control the same motor. For example one button controls just the indexer and the other controls the indexer and the intakes. I know this is very simple I just can’t think strait right now. Thanks in advance.
if(Controller.Button.pressing || Controller.OtherButton.pressing){
motor.spin;
}
else{
motor.stop;
}
Edit: I was thinking in Python
Since you are a “CodeMaster” I’ll give you something a little less direct. You have two buttons, for a total of four possible combinations, two (on/off) for the first button * two for the second button.
Take each of these four possible inputs and decide what you want each to do. Then write your code to execute that task for each set of inputs. Nothing too fancy, just some if/else statements.
I am sorry but I don’t think you understand what I am saying.
You are trying to control one motor with 2 different buttons, am I wrong?
Yah sorry my name is misleading. I would like to change it. Don’t I have to contact an admin for that.
@DRow is a kind man
No you are not wrong but what am saying is one button to control lets say just the intakes. But if I press another it will control both the intakes and the indexer. And in the case you wrote that won’t do that I don’t think unless I am not looking at it properly
Then add some more logic like @2775Josh said:
if(Controller.Button.pressing){
motor.spin;
}
else if(Controller.OtherButton.pressing){
motor.spin;
otherMotor.spin;
}
else{
motor.stop;
otherMotor.stop;
}
Yes thank you. That is what I was looking for . It was driving me crazy I couldn’t remember how to do this simple thing.