How to use one button call two functions

(this is my first post so I don’t know what tags to use) I wanted to know if its possible if you can somehow use one button to move two motors at the same time. for example im trying to code my intakes and im having a really hard time finding anything that helps

Just check if the button is pressing. If it is, turn on the motors. If it isn’t, turn them off.

if (Controller1.ButtonX.pressing()){
    motor1.spin(fwd);
    motor2.spin(fwd);
}
else{
    motor1.stop();
    motor2.stop();
}
3 Likes

thank you, I managed to get it working