anyone knows how to troubleshoot the error message
“make process closed with exit code : 2”
Here’s the code.
/*----------------------------------------------------------------------------*/
/* */
/* Module: main.cpp */
/* Author: VEX */
/* Created: Thu Sep 26 2019 */
/* Description: Competition Template */
/* */
/*----------------------------------------------------------------------------*/
// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name] [Type] [Port(s)]
// RightFrontMotor motor 1
// LeftFrontMotor motor 2
// RightBackMotor motor 3
// LeftBackMotor motor 4
// LeftArmLiftMotor motor 5
// LeftSpinMotor motor 6
// RightSpinMotor motor 7
// RightArmLiftMotor motor 8
// ---- END VEXCODE CONFIGURED DEVICES ----
#include "vex.h"
using namespace vex;
// A global instance of vex::brain
vex::brain Brain;
//A global instance of vex::competition
vex::competition Competition;
vex::motor RightFrontMotor = vex::motor(vex::PORT1);
vex::motor LeftFrontMotor = vex::motor(vex::PORT2, true);
vex::motor RightBackMotor = vex::motor(vex::PORT3);
vex::motor LeftBackMotor = vex::motor(vex::PORT4, true);
vex::motor LeftArmLiftMotor = vex::motor(vex::PORT5);
vex::motor RightArmLiftMotor = vex::motor(vex::PORT8);
vex::motor LeftSpinMotor = vex::motor(vex::PORT6, true);
vex::motor RightSpinMotor = vex::motor(vex::PORT7);
vex::controller Controller1 = vex::controller();
//vex::sensor Sensor = vex::sensor();
// define your global instances of motors and other devices here
/*---------------------------------------------------------------------------*/
/* 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 V5 has been powered on and */
/* not every time that the robot is disabled. */
/*---------------------------------------------------------------------------*/
void pre_auton(void) {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
// 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) {
// ..........................................................................
// Insert autonomous user code here.
// ..........................................................................
// Moving forward
LeftFrontMotor.setStopping(coast);
RightFrontMotor.setStopping(coast);
LeftBackMotor.setStopping(coast);
RightBackMotor.setStopping(coast);
LeftFrontMotor.setVelocity(100, percent);
RightFrontMotor.setVelocity(100, percent);
LeftBackMotor.setVelocity(100, percent);
RightBackMotor.setVelocity(100, percent);
LeftFrontMotor.startRotateFor(vex::directionType::fwd,1000,vex::rotationUnits::deg);
RightFrontMotor.startRotateFor(vex::directionType::fwd,1000,vex::rotationUnits::deg);
LeftBackMotor.startRotateFor(vex::directionType::fwd,1000,vex::rotationUnits::deg);
RightBackMotor.rotateFor(vex::directionType::fwd,1000,vex::rotationUnits::deg);
LeftFrontMotor.stop();
RightFrontMotor.stop();
LeftBackMotor.stop();
RightBackMotor.stop();
// Turning left
// Moving forward
// Moving forward
// Moving forward
}
/*---------------------------------------------------------------------------*/
/* */
/* 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
int ArmSpeedPercent = 100;
while (1) {
// This is the main execution loop for the user control program.
// Each time through the loop your program should update motor + servo
// values based on feedback from the joysticks.
// ........................................................................
// Insert user code here. This is where you use the joystick values to
// update your motors, etc.
// ........................................................................
//This section drives the chassis
RightFrontMotor.spin(vex::directionType::fwd, Controller1.Axis2.position(), vex::velocityUnits::pct);
RightBackMotor.spin(vex::directionType::fwd, Controller1.Axis2.position(), vex::velocityUnits::pct);
LeftFrontMotor.spin(vex::directionType::fwd, Controller1.Axis3.position(), vex::velocityUnits::pct);
LeftBackMotor.spin(vex::directionType::fwd, Controller1.Axis3.position(), vex::velocityUnits::pct);
//This section is for the arm control aspect of the program
if(Controller1.ButtonR1.pressing()){
RightArmLiftMotor.spin(vex::directionType::fwd,ArmSpeedPercent,vex::velocityUnits::pct);
}
else if(Controller1.ButtonR2.pressing()){
RightArmLiftMotor.spin(vex::directionType::rev,ArmSpeedPercent,vex::velocityUnits::pct);
}
else {
RightArmLiftMotor.stop(vex::brakeType::brake);
}
if(Controller1.ButtonL1.pressing()){
LeftArmLiftMotor.spin(vex::directionType::fwd,ArmSpeedPercent,vex::velocityUnits::pct);
}
else if(Controller1.ButtonL2.pressing()){
LeftArmLiftMotor.spin(vex::directionType::rev,ArmSpeedPercent,vex::velocityUnits::pct);
}
else {
LeftArmLiftMotor.stop(vex::brakeType::brake);
}
//This section is for the intake control aspect of the program
if(Controller1.ButtonL1.pressing()){
RightSpinMotor.spin(vex::directionType::fwd,ArmSpeedPercent,vex::velocityUnits::pct);
LeftSpinMotor.spin(vex::directionType::fwd,ArmSpeedPercent,vex::velocityUnits::pct);
}
else if(Controller1.ButtonL2.pressing()){
RightSpinMotor.spin(vex::directionType::rev,ArmSpeedPercent,vex::velocityUnits::pct);
LeftSpinMotor.spin(vex::directionType::rev,ArmSpeedPercent,vex::velocityUnits::pct);
}
else {
RightSpinMotor.stop(vex::brakeType::brake);
LeftSpinMotor.stop(vex::brakeType::brake);
}
wait(20, msec); // Sleep the task for a short amount of time to
// prevent wasted resources.
}
}
//
// Main will set up the competition functions and callbacks.
//
int main() {
// Set up callbacks for autonomous and driver control periods.
Competition.autonomous(autonomous);
Competition.drivercontrol(usercontrol);
// Run the pre-autonomous function.
pre_auton();
// Prevent main from exiting with an infinite loop.
while (true) {
wait(100, msec);
}
}