Hi! I am coding for a tray on our robot. The tray is supposed to go forward when the up arrow is pressed. It’s supposed to go back when the back arrow is pressed.
Unfortunately, I have a problem. When I put in the code, nothing worked. By nothing, I mean our wheels didn’t move when the joystick was pushed, the arms didn’t raise with the buttons, anything. The tray itself didn’t work as well.
I think it may be because I didn’t code for the up and down buttons correctly. I’ve never coded for the arrows, so I think I made a mistake. The following is my code for the tray.
if(Controller1.ButtonUp.pressing()) { //If button L2 is pressed...
//...Spin the arm motor forward.
Tray.spin(vex::directionType::fwd, traySpeedPCT, vex::velocityUnits::pct);
}
else if(Controller1.ButtonDown.pressing()) { //If button L2 is pressed...
//...Spin the arm motor backward.
Tray.spin(vex::directionType::rev, traySpeedPCT, vex::velocityUnits::pct);
}
else { //If the R1 or R2 button is not pressed...
//...Stop the arm motor.
Tray.stop(vex::brakeType::brake);
}
Please tell me if I coded for the arrows incorrectly!