/*----------------------------------------------------------------------------*/
/* */
/* Module: main.cpp */
/* Author: VEX */
/* Created: Thu Sep 26 2019 */
/* Description: Competition Template */
/* */
/*----------------------------------------------------------------------------*/
// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name] [Type] [Port(s)]
// Controller1 controller
// Controller2 controller
// Motor2 motor 2
// Motor8 motor 8
// Motor11 motor 11
// Motor20 motor 20
// ---- END VEXCODE CONFIGURED DEVICES ----
#include "vex.h"
using namespace vex;
// A global instance of competition
competition Competition;
void pre_auton(void) {
vexcodeInit();
}
void autonomous(void) {
Motor11.startRotateFor(30*360,vex::rotationUnits::deg, 100, vex::velocityUnits::pct);
Motor20.rotateFor(30*360,vex::rotationUnits::deg, 100, vex::velocityUnits::pct);
}
void usercontrol(void) {
while (1) {
Motor11.spin(directionType::fwd, Controller1.Axis3.value(), velocityUnits::pct);
Motor20.spin(directionType::fwd,Controller1.Axis2.value(), velocityUnits::pct);
if (Controller2.ButtonL1.pressing()) {
Motor2.spin(vex::directionType::fwd, 75,velocityUnits::pct);
Motor8.spin(vex::directionType::fwd, 75,velocityUnits::pct);
} else if (Controller2.ButtonL2.pressing()) {
Motor2.spin(vex::directionType::rev, 75,velocityUnits::pct);
Motor8.spin(vex::directionType::rev, 75 ,velocityUnits::pct);
} else {
Motor2.stop(brakeType::hold);
Motor8.stop(brakeType::hold);
}
wait(20, msec);
}
}
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.
}
}
The bits of the message you omitted would have more information about what’s wrong
1 Like
Can you upload the whole folder with all of the code in the robot-config.cpp file I have had many errors.
The most common mistake that causes [error]: make process closed with exit code: 2
is having spaces in the program or folder name. See this topic:
1 Like