Auton motor code not working in c++

We were coding our autonomous program and when we tested it the wheel motors would never spin but pneumatics would still work. This was all written in c++. So we thought to try to write it in blocks then transfer it over, when we did that the blocks program ran perfectly then after we copied it over in to our text program, the code would not work again.

Could you send the program, so I could take a look at what may be wrong?

here it is.

#pragma region VEXcode Generated Robot Configuration
// Make sure all required headers are included.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>


#include "vex.h"

using namespace vex;

// Brain should be defined by default
brain Brain;


// START V5 MACROS
#define waitUntil(condition)                                                   \
  do {                                                                         \
    wait(5, msec);                                                             \
  } while (!(condition))

#define repeat(iterations)                                                     \
  for (int iterator = 0; iterator < iterations; iterator++)
// END V5 MACROS


// Robot configuration code.
motor backleft = motor(PORT1, ratio18_1, true);

motor backright = motor(PORT2, ratio18_1, false);

motor middleleft = motor(PORT3, ratio18_1, true);

motor middleright = motor(PORT4, ratio18_1, false);

motor frontleft = motor(PORT5, ratio18_1, true);

motor frontright = motor(PORT6, ratio18_1, false);

motor intaketop = motor(PORT7, ratio18_1, false);

motor intakebottem = motor(PORT8, ratio18_1, true);

controller Controller1 = controller(primary);
digital_out BackClamp = digital_out(Brain.ThreeWirePort.A);
digital_out IntakeDrop = digital_out(Brain.ThreeWirePort.B);
motor liftmotor = motor(PORT9, ratio18_1, false);

digital_out IntakeLift = digital_out(Brain.ThreeWirePort.C);


// generating and setting random seed
void initializeRandomSeed(){
  int systemTime = Brain.Timer.systemHighResolution();
  double batteryCurrent = Brain.Battery.current();
  double batteryVoltage = Brain.Battery.voltage(voltageUnits::mV);

  // Combine these values into a single integer
  int seed = int(batteryVoltage + batteryCurrent * 100) + systemTime;

  // Set the seed
  srand(seed);
}



void vexcodeInit() {

  //Initializing random seed.
  initializeRandomSeed(); 
}


// Helper to make playing sounds from the V5 in VEXcode easier and
// keeps the code cleaner by making it clear what is happening.
void playVexcodeSound(const char *soundName) {
  printf("VEXPlaySound:%s\n", soundName);
  wait(5, msec);
}



// define variable for remote controller enable/disable
bool RemoteControlCodeEnabled = true;

#pragma endregion VEXcode Generated Robot Configuration

// Include the V5 Library
#include "vex.h"
  
// Allows for easier use of the VEX Library
using namespace vex;
competition Competition;

motor_group mgL(frontleft, middleleft, backleft);
motor_group mgR(frontright, middleright, backright);
drivetrain DT(mgL, mgR);

bool clamp = false;
bool lift = false;
float speed_mod = 1.0;

//================================================================================================
int whenStarted1() {
  intaketop.setVelocity(100, percent);
  intakebottem.setVelocity(100, percent);
  liftmotor.setVelocity(100, percent);
  BackClamp.set(false);
  IntakeDrop.set(false);
//================================================================================================
  while (true) {
    mgL.setVelocity(Controller1.Axis3.position() * speed_mod, percent);
    mgR.setVelocity(Controller1.Axis2.position() * speed_mod, percent);
    mgL.spin(forward);
    mgR.spin(forward);
//================================================================================================
  wait(5, msec);
  }
  return 0;
}

// Button L1, toggles clamp
void onevent_Controller1ButtonL1_pressed_0() {
  clamp = !clamp;
  BackClamp.set(clamp);
}

// Button B, toggles lift pneumatics and motor
void onevent_Controller1ButtonB_pressed_0() {
  lift = !lift;
  IntakeDrop.set(lift);
  IntakeLift.set(lift);
  if (lift == false) {
    liftmotor.spinToPosition(-150, degrees);
  }
  else {
    liftmotor.spinToPosition(-650, degrees);
  }
}

// Button R1, spins intake fowards, if lift is down set to correct position
void onevent_Controller1ButtonR1_pressed_0() {
  intakebottem.spin(forward);
  intaketop.spin(forward);
    if (lift == false) {
  liftmotor.spinToPosition(-150, degrees);
  }
}

// Button R2, spins intake backwards, if lift is down then lower it a bit
void onevent_Controller1ButtonR2_pressed_0() {
  intakebottem.spin(reverse);
  intaketop.spin(reverse);
  if (lift == false) {
    liftmotor.spinToPosition(-50, degrees);
  }
}

// Release Button R1, stops intake
void onevent_Controller1ButtonR1_released_0() {
    intakebottem.stop();
    intaketop.stop();
}

// Release Button R2, stops intake
void onevent_Controller1ButtonR2_released_0() {
    intakebottem.stop();
    intaketop.stop();
}

// Button L2, modifies bot's speed to %20
void onevent_Controller1ButtonL2_pressed_0() {
  speed_mod = 0.2;
}

// Release Button L2, returns bot's speed to %100
void onevent_Controller1ButtonL2_released_0() {
  speed_mod = 1;
}

// "when autonomous" hat block
int onauton_autonomous_0() {
  backleft.spin(reverse);
  backright.spin(reverse);
  middleleft.spin(reverse);
  middleright.spin(reverse);
  frontleft.spin(reverse);
  frontright.spin(reverse);
  wait(1.0, seconds);
  backleft.stop();
  backright.stop();
  middleleft.stop();
  middleright.stop();
  frontleft.stop();
  frontright.stop();
  return 0;
}

void VEXcode_driver_task() {
  // Start the driver control tasks....

  while(Competition.isDriverControl() && Competition.isEnabled()) {this_thread::sleep_for(10);}

  return;
}

void VEXcode_auton_task() {
  // Start the auton control tasks....
  vex::task auto0(onauton_autonomous_0);
  while(Competition.isAutonomous() && Competition.isEnabled()) {this_thread::sleep_for(10);}
  auto0.stop();
  return;
}



int main() {
  vex::competition::bStopTasksBetweenModes = false;
  Competition.autonomous(VEXcode_auton_task);
  Competition.drivercontrol(VEXcode_driver_task);

  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

  // register event handlers
  Controller1.ButtonB.pressed(onevent_Controller1ButtonB_pressed_0);
  Controller1.ButtonL1.pressed(onevent_Controller1ButtonL1_pressed_0);
  Controller1.ButtonR1.pressed(onevent_Controller1ButtonR1_pressed_0);
  Controller1.ButtonR2.pressed(onevent_Controller1ButtonR2_pressed_0);
  Controller1.ButtonR1.released(onevent_Controller1ButtonR1_released_0);
  Controller1.ButtonR2.released(onevent_Controller1ButtonR2_released_0);
  Controller1.ButtonL2.pressed(onevent_Controller1ButtonL2_pressed_0);
  Controller1.ButtonL2.released(onevent_Controller1ButtonL2_released_0);

  wait(15, msec);
  // post event registration

  // set default print color to black
  printf("\033[30m");

  // wait for rotation sensor to fully initialize
  wait(30, msec);

  whenStarted1();
}

edit: code tags added by moderator, please remember to use them.

I know this is a little bit off topic, but what’s the point of the #pragma region VEXcode Generated Robot Configuration? I know what it does in code editors, and how it’s used, but what purpose does it serve to your code?

Nevermind, I didn’t actually see where the region ended. I’m making another post because I can’t find the button to edit the first one.