Blockquote// VEX V5 C++ Project
#include "vex.h"
using namespace vex;
//#region config_globals
vex::brain Brain;
vex::motor FrontLeft(vex::PORT1, vex::gearSetting::ratio18_1, false);
vex::motor FrontRight(vex::PORT10, vex::gearSetting::ratio18_1, true);
vex::motor BackLeft(vex::PORT11, vex::gearSetting::ratio18_1, false);
vex::motor BackRight(vex::PORT20, vex::gearSetting::ratio18_1, true);
vex::controller Controller1(vex::controllerType::primary);
//#endregion config_globals
int main(void) {
while(1){
Controller1.Screen.setCursor(1,1);//Displays Front Left Motor Temp & Speed on controller
Controller1.Screen.print("T:" && FrontLeft.temperature(celsius) && "S:" && FrontLeft.velocity(pct));
Controller1.Screen.clearLine();
Brain.Screen.setCursor(1,1);//Displays Front Left Motor Temp & Speed on brain
Brain.Screen.print("T:" && FrontLeft.temperature(celsius) && "S:" && FrontLeft.velocity(pct));
Brain.Screen.clearLine();
Controller1.Screen.setCursor(1,2);//Displays Front Right Motor Temp & Speed on controller
Controller1.Screen.print("T:" && FrontRight.temperature(celsius) && "S:" && FrontRight.velocity(pct));
Controller1.Screen.clearLine();
Brain.Screen.setCursor(1,2);//Displays Front Right Motor Temp & Speed on brain
Brain.Screen.print("T:" && FrontRight.temperature(celsius) && "S:" && FrontRight.velocity(pct));
Brain.Screen.clearLine();
Controller1.Screen.setCursor(2,1);//Displays Back Left Motor Temp & Speed on controller
Controller1.Screen.print("T:" && BackLeft.temperature(celsius) && "S:" && BackLeft.velocity(pct));
Controller1.Screen.clearLine();
Brain.Screen.setCursor(2,1);//Displays Back Left Motor Temp & Speed on brain
Brain.Screen.print("T:" && BackLeft.temperature(celsius) && "S:" && BackLeft.velocity(pct));
Brain.Screen.clearLine();
Controller1.Screen.setCursor(2,2);//Displays Back Right Motor Temp & Speed on controller
Controller1.Screen.print("T:" && BackRight.temperature(celsius) && "S:" && BackRight.velocity(pct));
Controller1.Screen.clearLine();
Brain.Screen.setCursor(2,2);//Displays Back Right Motor Temp & Speed on brain
Brain.Screen.print("T:" && BackRight.temperature(celsius) && "S:" && BackRight.velocity(pct));
Brain.Screen.clearLine();
if(Controller1.Axis2.value() > 1){//Move Forward
FrontLeft.spin(forward, 75, vex::velocityUnits(pct));
FrontRight.spin(forward, 75, vex::velocityUnits(pct));
BackLeft.spin(forward, 75, vex::velocityUnits(pct));
BackRight.spin(forward, 75, vex::velocityUnits(pct));
}
else if(Controller1.Axis2.value() < -1){//Move Backward
FrontLeft.spin(forward, 75, vex::velocityUnits(pct));
FrontRight.spin(forward, 75, vex::velocityUnits(pct));
BackLeft.spin(forward, 75, vex::velocityUnits(pct));
BackRight.spin(forward, 75, vex::velocityUnits(pct));
}
else if(Controller1.Axis4.value() > 1){//Turn Left
FrontLeft.spin(reverse, 75, vex::velocityUnits(pct));
FrontRight.spin(forward, 75, vex::velocityUnits(pct));
BackLeft.spin(reverse, 75, vex::velocityUnits(pct));
BackRight.spin(forward, 75, vex::velocityUnits(pct));
}
else if(Controller1.Axis4.value() < -1){//Turn Right
FrontLeft.spin(forward, 75, vex::velocityUnits(pct));
FrontRight.spin(reverse, 75, vex::velocityUnits(pct));
BackLeft.spin(forward, 75, vex::velocityUnits(pct));
BackRight.spin(reverse, 75, vex::velocityUnits(pct));
}
else{
FrontLeft.stop();
FrontRight.stop();
BackLeft.stop();
BackRight.stop();
}
vex::sleep(1);
}
}