My team and I have started programming our robot. In this program, we have configured a couple of things: 2 controllers, 2 pneumatic pistons, 2 motors that we have configured into one motor group, and the drivetrain. When we run the program, all the pneumatics and motors work except for the drivetrain motors
What I think the issue is: since we have 2 controllers configured, I think that the drivetrain doesn’t know which controller to use.
we are a new team so any and all help would be nice!
here is the code:
#include "vex.h"
using namespace vex;
void intake_forward() { //not using yet, may use it later once code becomes more advance
intakeconveyor.spin(reverse);
}
void intake_reverse() { //not using yet, may use it later once code becomes more advance
intakeconveyor.spin(forward);
}
void intake_extend () {
intakeair.set(true);
}
void intake_retract () {
intakeair.set(false);
}
void clamp_retract () {
clampair.set(true);
}
void clamp_extend () {
clampair.set(false);
}
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
while(true) {
if (Controller2.ButtonR1.pressing()) {
intakeconveyor.setVelocity(100, percent);
intakeconveyor.spin(forward); //intake and conveyor eating
} else if (Controller2.ButtonL1.pressing()) {
intakeconveyor.spin(reverse); //intake and conveyor vomit
} else {
intakeconveyor.stop();
}
Drivetrain.setDriveVelocity(50, percent); //slowing down drivetrain speed
Drivetrain.setTurnVelocity(50, percent); //slowing down drivetrain turn speed
/*
leftfront.spin(reverse, (Controller1.Axis3.value() + Controller1.Axis1.value()), vex::velocityUnits::pct); //1 //old way to drive the drivetrain
leftback.spin(reverse, (Controller1.Axis3.value() + Controller1.Axis1.value()), vex::velocityUnits::pct); //2
rightfront.spin(reverse, (Controller1.Axis3.value() - Controller1.Axis1.value()), vex::velocityUnits::pct);//3
rightback.spin(reverse, (Controller1.Axis3.value() - Controller1.Axis1.value()), vex::velocityUnits::pct);//4
*/
Controller2.ButtonX.pressed(intake_extend); //intake pneumatic extend
Controller2.ButtonB.pressed(intake_retract); //intake pneumatic retract
Controller1.ButtonR1.pressed(clamp_extend); //clamp pneumatic extend
Controller1.ButtonR2.pressed(clamp_retract); //clamp pneumatic retract
}
}