My team and I have created a Vex V5 code for a reverse four bar lift robot and we are experiencing two issues,
A. The two rear dive motors (Motors 3 & 4) are stopping completely when the program begins and do not move even when attempting to manually force them to turn.
B. When complying, the program says that names like “Motor 1” and “Brain” are unidentified and I cannot understand why this would happen.
Below is my code in its entirety and attached is an image of the motor set up and the compilation errors I am experiencing. If you could help me in any way I would be grateful as we have a competition coming up soon (Sat. 2/2/19) and need to have this done as soon as possible. Thanks.
My team is the Cougar Renegades (42748C), and we compete in upstate South Carolina.
Code:
int main() {
Brain.Screen.setPenColor(vex::color::red);
Brain.Screen.print("Help they've trapped me in a robot!");
Brain.timer(15::sec);
Brain.Screen.clearScreen();
while(1) {
int counter = 0;
//Speed for Drive Motors
Motor1.setVelocity(100,vex::velocityUnits::rpm);
Motor2.setVelocity(100,vex::velocityUnits::rpm);
Motor3.setVelocity(100,vex::velocityUnits::rpm);
Motor4.setVelocity(100,vex::velocityUnits::rpm);
//Drive Control
Motor1.spin(vex::directionType::fwd, (Controller1.Axis4.value() + Controller1.Axis3.value())/2, vex::velocityUnits::pct);
Motor2.spin(vex::directionType::fwd, (Controller1.Axis4.value() - Controller1.Axis3.value())/2, vex::velocityUnits::pct);
Motor3.spin(vex::directionType::fwd, (Controller1.Axis4.value() + Controller1.Axis3.value())/2, vex::velocityUnits::pct);
Motor4.spin(vex::directionType::fwd, (Controller1.Axis4.value() - Controller1.Axis3.value())/2, vex::velocityUnits::pct);
//Claw Control A - Place Caps on Poles
if(Controller1.Axis2.value()>10) {
Motor5.spin(vex::directionType::fwd, 100, vex::velocityUnits::pct);
Motor6.spin(vex::directionType::fwd, 100, vex::velocityUnits::pct);
Motor7.spin(vex::directionType::fwd, 100, vex::velocityUnits::pct);
}
else if(Controller1.Axis2.value()<-10) {
Motor5.spin(vex::directionType::rev, 50, vex::velocityUnits::pct);
Motor6.spin(vex::directionType::rev, 50, vex::velocityUnits::pct);
Motor7.spin(vex::directionType::rev, 50, vex::velocityUnits::pct);
}
else {
Motor5.stop(brakeType::hold);
Motor6.stop(brakeType::hold);
Motor7.stop(brakeType::hold);
}
//Claw Control B - Flip Caps
if(Controller1.ButtonX.pressing()) {
Motor7.spin(directionType::fwd,100,velocityUnits::rpm);
}
else if(Controller1.ButtonB.pressing()) {
Motor7.spin(directionType::rev,50,velocityUnits::rpm);
}
else {
Motor7.stop(brakeType::hold);
}
//Claw Control C - Claw Swivel
if (counter) = 0 {
if(Controller1.ButtonR1.pressed(pressedFunction); {
Motor.rotateTo(180,rotationUnits::deg,50,velocityUnits::pct);
counter = 1
Brain.timer(10::sec);
counter = 0
}
else {
FClaw.stop(brakeType::hold);
}
}
}
}
Motor set up
Compilation errors
Compilation errors Cont.