Can someone Plz test this code and just see if the Motors are working?

#include “robot-config.h”
/---------------------------------------------------------------------------/
/* /
/
Description: Competition template for VCS VEX V5 /
/
/
/
---------------------------------------------------------------------------*/

//Creates a competition object that allows access to Competition methods.
vex::competition Competition;

/---------------------------------------------------------------------------/
/* 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 ) {
// …
// Insert autonomous user code here.
// …

}

/----------------------------------------------------------------------------/
/* /
/
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){
// 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.
// ........................................................................

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) {using namespace vex;

vex::motor Frontleftmotor (vex::PORT1, vex::gearSetting::ratio18_1,false);
vex::motor Frontrightmotor (vex::PORT2, vex::gearSetting::ratio18_1,true);
vex::motor Backleftmotor (vex::PORT3, vex::gearSetting::ratio18_1,false);
vex::motor Backrightmotor (vex::PORT4, vex::gearSetting::ratio18_1,true);
vex::motor Arm1 (vex::PORT5, vex::gearSetting::ratio18_1,true);
#include “robot-config.h”

while(true)
{
    Backleftmotor.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct); //(Axis3+Axis4)/2
    Backrightmotor.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);//(Axis1-Axis2)/2
    Frontleftmotor.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct); //(Axis2+Axis1)/2
    Frontrightmotor.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct); //(Axis4+Axis3)/2

if (Controller1.ButtonUp.pressing())
{

Arm1.spin(vex::directionType::fwd,200, vex::velocityUnits::pct);

}

else if (Controller1.ButtonDown.pressing())
{

Arm1.spin(vex::directionType::rev, 200, vex::velocityUnits::pct);

}

else if (!Controller1.ButtonUp.pressing())
{

Arm1.stop();

}

       else if (!Controller1.ButtonDown.pressing())
       {
           Arm1.stop();
       }
   }



  vex::task::sleep(100);//Sleep the task for a short amount of time to prevent wasted resources.
}    

}

Why is your entire user control code not in the usercontrol loop?

we can’t test your code because our robots aren’t identical to yours

i believe they just want to make sure the motors spin, if im not mistaken

ah I didn’t actually go and read the code lol. thought they wanted us to test their robot’s code with our robots. my bad

no problem haha. often times its when they dont have access to motors or something

I haven’t tested it, but I can give a few recommendations after skimming it:

  1. Put your user control stuff in the user control task for cleanliness.
  2. Move your motor declarations to robot-config.h to clean up this file.
  3. You have two embedded while(true) or while(1) loops. That’s wasted code muddying things up. The outer one will never repeat because you get stuck in the inner one.
  4. You’ve commented that you’re using an odd form of semi-arcade/semi-tank control, but you’ve coded it for tank control.
  5. You’re trying to spin Arm1 at 200% of its maximum speed. Won’t happen. I would either change the number or change the units.
  6. Get rid of those two “else if” parts in the Arm1 commands and just use a single “else” to stop the motor. It will clean things up.