Code seems ok, but when I compile, there’s an error in the console.
“13:51:53 – info – make process failed with return code: 1”
Code Below
#include “robot-config.h”
/---------------------------------------------------------------------------/
/* /
/ Description: Competition template for VCS VEX V5 /
/ /
/---------------------------------------------------------------------------*/
//Creates a competition object that allows access to Competition methods.
/---------------------------------------------------------------------------/
/* Pre-Autonomous Functions /
/ /
/ You may want to perform some actions before the competition starts. /
/ Do them in the following function. You must return from this function /
/ or the autonomous and usercontrol tasks will not be started. This /
/ function is only called once after the cortex has been powered on and /
/ not every time that the robot is disabled. /
/---------------------------------------------------------------------------*/
void pre_auton( void );
// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, …
/---------------------------------------------------------------------------/
/* /
/ Autonomous Task /
/ /
/ This task is used to control your robot during the autonomous phase of /
/ a VEX Competition. /
/ /
/ You must modify the code to add your own robot specific commands here. /
/---------------------------------------------------------------------------*/
void autonomous( void ) {
}
/----------------------------------------------------------------------------/
/* /
/ User Control Task /
/ /
/ This task is used to control your robot during the user control phase of /
/ a VEX Competition. /
/ /
/ You must modify the code to add your own robot specific commands here. /
/----------------------------------------------------------------------------*/
void usercontrol( void ) {
// User control code here, inside the loop
while (1){
DriveLF.spin(directionType::fwd,Controller1.Axis3.position(percentUnits::pct),velocityUnits::pct);
DriveRF.spin(directionType::fwd,Controller1.Axis2.position(percentUnits::pct),velocityUnits::pct);
DriveLB.spin(directionType::fwd,Controller1.Axis3.position(percentUnits::pct),velocityUnits::pct);
DriveRB.spin(directionType::fwd,Controller1.Axis2.position(percentUnits::pct),velocityUnits::pct);
//Lift
if(Controller1.ButtonL1.pressing()){
Lift.spin(directionType::fwd, 95, velocityUnits::pct);
}
else if(Controller1.ButtonL2.pressing()){
Lift.spin(directionType::rev, 95, velocityUnits::pct);
}
else{
Lift.stop(brakeType::hold);
}
//Flipper
if(Controller1.ButtonR1.pressing()){
Flipper.spin(directionType::fwd, 100, velocityUnits::pct);
}
else if(Controller1.ButtonR2.pressing()){
Flipper.spin(directionType::rev, 100, velocityUnits::pct);
}
else{
Flipper.stop(brakeType::hold);
}
//Intake
if(Controller2.ButtonL1.pressing()){
Intake.spin(directionType::fwd, 100, velocityUnits::pct);
}
else if(Controller2.ButtonL2.pressing()){
Intake.spin(directionType::rev, 100, velocityUnits::pct);
}
else{
Intake.stop(brakeType::coast);
}
//Launcher
if(Controller2.ButtonR1.pressing()){
Launcher.spin(directionType::fwd, 100, velocityUnits::pct);
}
else if(Controller2.ButtonR2.pressing()){
Launcher.spin(directionType::rev, 100, velocityUnits::pct);
}
else{
Launcher.stop(brakeType::coast);
}
}
vex::task::sleep(20); //Sleep the task for a short amount of time to prevent wasted resources.
}
//
// Main will set up the competition functions and callbacks.
//
int main() {
//Run the pre-autonomous function.
pre_auton();
//Set up callbacks for autonomous and driver control periods.
Competition.autonomous( autonomous );
Competition.drivercontrol( usercontrol );
//Prevent main from exiting with an infinite loop.
while(1) {
vex::task::sleep(100);//Sleep the task for a short amount of time to prevent wasted resources.
}
}