Random Motors Not Stopping

Hi,
Our team really needs some help quickly. The motors turn forward when pressed and backwards when pressed but won’t stop turning backwards after being pressed to go backwards. We have checked the code and everything was fine. 5 minutes ago it was working fine and then it stopped working. We have reset the core and deleted the programs and uploaded them but it still won’t work.
Please Help Urgently!!!

post code? send pics? no one can help a whole lot based off of just a paragraph

Sorry I didn’t have the code before as I am not the coder but here it is.
main.cpp

/*----------------------------------------------------------------------------*/

/*                                                                            */

/*    Module:       main.cpp                                                  */

/*    Author:       VEX                                                       */

/*    Created:      Thu Sep 26 2019                                           */

/*    Description:  Competition Template                                      */

/*                                                                            */

/*----------------------------------------------------------------------------*/

// ---- START VEXCODE CONFIGURED DEVICES ----

// Robot Configuration:

// [Name]               [Type]        [Port(s)]

// RightMotor           motor         1              

// LeftMotor            motor         10              

// ArmMotorRight        motor         2              

// ArmMotorLeft         motor         9              

// ConveyorMotorRight   motor         3              

// ConveyorMotorLeft    motor         8              

// Controller1          controller                    

// ---- END VEXCODE CONFIGURED DEVICES ----

#include "vex.h"

#include "Autonomous.h"

using namespace vex;

// A global instance of competition

competition Competition;

// 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();

  RightMotor.setPosition(0, degrees);

  LeftMotor.setPosition(0, degrees);

  ArmMotorRight.setPosition(0, degrees);

  ArmMotorLeft.setPosition(0, degrees);

  ConveyorMotorRight.setPosition(0, degrees);

  ConveyorMotorLeft.setPosition(0, degrees); */

  // All activities that occur before the competition starts

  // Example: clearing encoders, setting servo positions, ...

}

/*                              Autonomous Task                              */

void autonomous (void) {

  Autonomous A = Autonomous(0.05, LeftMotor, RightMotor, ArmMotorLeft, ArmMotorRight, ConveyorMotorLeft, ConveyorMotorRight);

  A.arms(350);

 // wait(1, seconds);

  A.goForwards(0.6);

  //wait(2.5, seconds);

  A.intake(-30);

 // wait(4, seconds);

  /*A.goForwards(-0.55);

  wait(5.5, seconds);

  A.arms(-340);

  wait(7, seconds);

  A.rotation(-90);

  wait(9, seconds);

  A.goForwards(0.42);

  wait(10, seconds);

  A.intake(15);

  wait(11, seconds);

  A.rotation(90);

  wait(13, seconds);

  A.goForwards(0.6);

  wait(15, seconds);

  A.intake(15);

  wait(16.5, seconds);

  A.rotation(-70);

  wait(18.5, seconds);

  A.goForwards(0.25);

  wait(19.5, seconds);

  A.arms(340);

  wait(20.5, seconds);

  A.intake(-30);

  //not necessary from here

  wait(22, seconds);

  A.arms(-340);

  wait(23, seconds);

  A.rotation(-90);

  wait(25, seconds);

  A.goForwards(0.153); // <- length of field square - robot length (24" - 18")

  wait(25.5, seconds);

  A.rotation(90);

  wait(27.5, seconds);

  A.goForwards(0.153);

  wait(28, seconds);

  A.intake(15);

  wait(29, seconds);

  A.goForwards(0.45);

  wait(30, seconds);

  A.rotation(90);

  wait(5.5, seconds);

  A.goForwards(0.153);

  A.intake(15);

  A.rotation(-90);

  A.goForwards(0.153);

  A.arms(340);

  A.intake(-30); //ONLY OUTTAKE THE FIRST BALL!!1!!!!11!!1!!11

  A.rotation(-90);

  A.goForwards(0.45);

  A.intake(15);

  A.rotation(20);

  A.goForwards(0.2); */

  //simple auton for comp bro (general term!!!) idk

 /*  ConveyorMotorLeft.rotateFor(50, rotationUnits::rev, 50, velocityUnits::pct, false);  

    ConveyorMotorRight.rotateFor(50, rotationUnits::rev, 50, velocityUnits::pct, false); //Suck up ball

    vex::task::sleep(10);

    ArmMotorLeft.rotateFor(50, rotationUnits::rev, 50, velocityUnits::pct, false);

    ArmMotorRight.rotateFor(50, rotationUnits::rev, 50, velocityUnits::pct, false); //Continue lifting arms to required position

    vex::task::sleep(10);

    RightMotor.rotateFor(950, rotationUnits::rev, 50, velocityUnits::pct, false); //Turn to the right

    vex::task::sleep(10);

    ConveyorMotorLeft.rotateTo(-50, rotationUnits::rev, 50, velocityUnits::pct, false);

    ConveyorMotorRight.rotateTo(-50, rotationUnits::rev, 50, velocityUnits::pct, false); //Put down ball

    vex::task::sleep(10);

    */

/*task autonomous()

{

vex::task:sleep(100)

while(SensorValue(sonarSensor) > 20 || SensorValue(sonarSensor) == -1)

{

motor[robotMotor1] = -127;

motor[robotMotor2] = -127;

motor[robotMotor3] = -127;

motor[robotMotor4] = -127;

} */

}

//User Control Task

void ConveyorIn (void) {

    ConveyorMotorLeft.spin(directionType::fwd, 50, vex::velocityUnits::pct);

    ConveyorMotorRight.spin(directionType::fwd, 50, vex::velocityUnits::pct);

}

void ConveyorStop (void){

    ConveyorMotorLeft.stop(brakeType::hold);

    ConveyorMotorRight.stop(brakeType::hold);

}

void ConveyorOut (void) {

    ConveyorMotorLeft.spin(directionType::rev, 50, vex::velocityUnits::pct);

    ConveyorMotorRight.spin(directionType::rev, 50, vex::velocityUnits::pct);

}

void ArmUp (void) {

    ArmMotorLeft.spin(directionType::rev, 50, vex::velocityUnits::pct);

    ArmMotorRight.spin(directionType::rev, 50, vex::velocityUnits::pct);

 if (ArmMotorLeft.position(vex::degrees) > 70){

      ArmMotorLeft = 70;

 }

 if (ArmMotorRight.position(vex::degrees) > 70){

      ArmMotorRight = 70;

 }

}

void ArmStop (void){

    ArmMotorLeft.stop(brakeType::hold);

    ArmMotorRight.stop(brakeType::hold);

}

void ArmDown (void) {

    ArmMotorLeft.spin(directionType::fwd, 50, vex::velocityUnits::pct);

    ArmMotorRight.spin(directionType::fwd, 50, vex::velocityUnits::pct);

} 

void AbortMission (void) {

    RightMotor.stop();

    LeftMotor.stop();

    ArmMotorRight.stop();

    ArmMotorLeft.stop();

    ConveyorMotorRight.stop();

    ConveyorMotorLeft.stop();

}

//int easedown = 100;

void usercontrol(void) {

  // User control code here, inside the loop

 

  while (1) {

    Controller1.ButtonR2.pressed(ArmUp);

    Controller1.ButtonR1.pressed(ArmDown); 

    Controller1.ButtonX.pressed(ConveyorIn);

    Controller1.ButtonB.pressed(ConveyorOut);

    Controller1.ButtonR1.released(ArmStop);

    Controller1.ButtonR2.released(ArmStop); 

    Controller1.ButtonX.released(ConveyorStop);

    Controller1.ButtonB.released(ConveyorStop);

    Controller1.ButtonA.pressed(AbortMission);

 int leftPercent = (Controller1.Axis3.value() + Controller1.Axis4.value())/2;

 int rightPercent = (Controller1.Axis3.value() - Controller1.Axis4.value())/2;

 if (leftPercent >70){

      leftPercent = 70;

 }

 if(rightPercent >70){

      rightPercent = 70;

 }

    LeftMotor.spin(directionType::fwd, leftPercent, velocityUnits::pct); //(Axis3+Axis4)/2;

    RightMotor.spin(directionType::fwd, rightPercent, velocityUnits::pct);//(Axis3-Axis4)/2;

 task::sleep(20);

    Brain.Screen.print("jbhbmngfgchk,lugj"); 

    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) {

/* { {RightMotor.spin(directionType::fwd, easedown, velocityUnits::rpm);

      task::sleep(30);

     easedown = easedown*(0.95); */

    wait(100, msec);

  }

}

//

// Main will set up the competition functions and callbacks.

//

 

vex.h

/*----------------------------------------------------------------------------*/

/*                                                                            */

/*    Module:       vex.h                                                     */

/*    Author:       Vex Robotics                                              */

/*    Created:      1 Feb 2019                                                */

/*    Description:  Default header for V5 projects                            */

/*                                                                            */

/*----------------------------------------------------------------------------*/

//

#include <math.h>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include "v5.h"

#include "v5_vcs.h"

#include "robot-config.h"

#define waitUntil(condition)                                                   \

  do {                                                                         \

    wait(5, msec);                                                             \

  } while (!(condition))

#define repeat(iterations)                                                     \

  for (int iterator = 0; iterator < iterations; iterator++)

autonomous.cpp

#include <iostream>

#include "Autonomous.h"

using namespace std;

using namespace vex;

Autonomous::Autonomous(double r, motor &lm, motor &rm, motor&ra, motor&la, motor&lc, motor&rc) {

  this->radius = r;

  this->LeftMotor = &lm;

  this->RightMotor = &rm;

  this->ArmMotorLeft = &la;

  this->ArmMotorRight = &ra;

  this->ConveyorMotorLeft = &lc;

  this->ConveyorMotorRight = &rc;

 

}; 

void Autonomous::goForwards(double howFar){

  double r = this->radius;

  double c = 2 *3.141592653589793238462643350288 *r;

  double revolutions  = howFar/c;

  this->LeftMotor->rotateTo(revolutions, rotationUnits::rev, false);

  this->RightMotor->rotateTo(revolutions, rotationUnits::rev, false);

  cout <<"hello\n";

};

void Autonomous::rotation(double degrees){

 double r = 0.38/2;

 double distance = degrees *3.1415926 *r /180;

    rhsDistance(distance);

    lhsDistance(-distance);

    cout << "Rotation\n";

};

void Autonomous::lhsDistance(double howFar){

 double r = this->radius;

 double c = 2 *3.141592653589793238462643350288 *r;

 double revolutions  = howFar/c;

 this->LeftMotor->rotateTo(revolutions, rotationUnits::rev, false);

    cout << "LhS\n";

};

void Autonomous::rhsDistance(double howFar){

 double r = this->radius;

 double c = 2 *3.141592653589793238462643350288 *r;

 double revolutions  = howFar/c;

 this->RightMotor->rotateTo(revolutions, rotationUnits::rev, false);

};

void Autonomous::arms(double degrees){

this->ArmMotorLeft->rotateTo(degrees, rotationUnits::deg, false);

this->ArmMotorRight->rotateTo(degrees, rotationUnits::deg, false);

};

void Autonomous::intake(double howFar){

  double d = 0.048;

  double revolutions = howFar *d *2;

  this->ConveyorMotorLeft->rotateTo(revolutions, rotationUnits::rev, false);

  this->ConveyorMotorRight->rotateTo(revolutions, rotationUnits::rev, false);

};

/*void Autonomous::outtake(double howFar){

  double d = 0.048;

  double revolutions = howFar/d;

  this->ConveyorMotorLeft->rotateTo(revolutions, rotationUnits::rev, false);

  this->ConveyorMotorRight->rotateTo(revolutions, rotationUnits::rev, false);

}; */

autonomous.h

#include "vex.h"

class Autonomous {

  public:

 double radius;

 motor *LeftMotor;

 motor *RightMotor;

 motor *ArmMotorLeft;

 motor *ArmMotorRight;

 motor *ConveyorMotorLeft;

 motor *ConveyorMotorRight;

    Autonomous(double r, motor &lm, motor &rm, motor &la, motor &ra, motor &lc, motor&rc);

 //moves the robot forward using a provided distance (m)

 void goForwards(double howFar);

 //rotates the robot a given angle (deg)

 void rotation(double degrees);

 //moves the left wheel a given distance (m)

 void lhsDistance(double howFar);

 //moves the right wheel a given distance (m)

 void rhsDistance(double howFar);

 //Raises arms to a given degree

 void arms(double degrees);

 //Moves conveyors a certain distance (m)

 void intake(double howFar);

}; 

robot-config.cpp

#include "vex.h"

using namespace vex;

using signature = vision::signature;

using code = vision::code;

// A global instance of brain used for printing to the V5 Brain screen

brain  Brain;

// VEXcode device constructors

motor RightMotor = motor(PORT1, ratio18_1, true);

motor LeftMotor = motor(PORT10, ratio18_1, false);

motor ArmMotorRight = motor(PORT2, ratio18_1, true);

motor ArmMotorLeft = motor(PORT9, ratio18_1, false);

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

motor ConveyorMotorLeft = motor(PORT8, ratio18_1, false);

controller Controller1 = controller(primary);

// VEXcode generated functions

// define variable for remote controller enable/disable

bool RemoteControlCodeEnabled = true;

/**

 * Used to initialize code/tasks/devices added using tools in VEXcode Pro.

 *

 * This should be called at the start of your int main function.

 */

void vexcodeInit( void ) {

  // nothing to initialize

}

robot-config.h

using namespace vex;

extern brain Brain;

// VEXcode devices

extern motor RightMotor;

extern motor LeftMotor;

extern motor ArmMotorRight;

extern motor ArmMotorLeft;

extern motor ConveyorMotorRight;

extern motor ConveyorMotorLeft;

extern controller Controller1;

/**

 * Used to initialize code/tasks/devices added using tools in VEXcode Pro.

 *

 * This should be called at the start of your int main function.

 */

void  vexcodeInit( void );

as someone who doesn’t code a whole lot no offense but i’m not parsing through all that

can u just show the relevant bits and format it better pls lol

yea, don’t register events in a loop.

Controller1.ButtonR2.pressed(ArmUp);

all these statements using pressed should only ever be called once.

5 Likes