Yea of course and I will edit the question
#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.
controller Controller1 = controller(primary);
motor leftMotorA = motor(PORT15, ratio18_1, false);
motor leftMotorB = motor(PORT16, ratio18_1, false);
motor_group LeftDriveSmart = motor_group(leftMotorA, leftMotorB);
motor rightMotorA = motor(PORT17, ratio18_1, true);
motor rightMotorB = motor(PORT19, ratio18_1, true);
motor_group RightDriveSmart = motor_group(rightMotorA, rightMotorB);
drivetrain Drivetrain = drivetrain(LeftDriveSmart, RightDriveSmart, 319.19, 295, 40, mm, 1);
motor MAINFLYWHEEL = motor(PORT2, ratio6_1, false);
digital_out DigitalOutC = digital_out(Brain.ThreeWirePort.C);
digital_out DigitalOutB = digital_out(Brain.ThreeWirePort.B);
motor INTAKE1 = motor(PORT4, ratio18_1, false);
motor INTAKE2 = motor(PORT5, ratio18_1, true);
motor ROLLERLOL = motor(PORT7, ratio36_1, false);
optical OpticalSeNoR = optical(PORT11);
inertial InertialTHING = inertial(PORT8);
rotation LEFTROT = rotation(PORT20, false);
rotation RIGHTROT = rotation(PORT18, false);
// define variable for remote controller enable/disable
bool RemoteControlCodeEnabled = true;
#pragma endregion VEXcode Generated Robot Configuration
//PROPER CODE STARTS HERE
//______________________________
//______________________________
//______________________________
//______________________________
//______________________________
//______________________________
//______________________________
//______________________________
//______________________________
// Include the V5 Library
#include "vex.h"
// Allows for easier use of the VEX Library
using namespace vex;
competition Competition;
float myVariable, TIME_BETWEEN_INNOUT;
event message1 = event();
event Mediumback = event();
event mediumforward = event();
event Slowforward = event();
event Slowbackward = event();
event Mediumright = event();
event Mediumleft = event();
event Slowright = event();
event Slowleft = event();
event endgame = event();
event ROLLER = event();
event colors = event();
// "when autonomous" hat block
int onauton_autonomous_0() {
OpticalSeNoR.setLight(ledState::on);
InertialTHING.startCalibration();
while (InertialTHING.isCalibrating()) { task::sleep(50); }
wait(0.85, seconds);
OpticalSeNoR.setLightPower(100.0, percent);
ROLLERLOL.setVelocity(100.0, percent);
Drivetrain.setTurnVelocity(5, percent);
Drivetrain.setDriveVelocity(10, percent);
Drivetrain.drive(forward);
Drivetrain.setStopping(brake);
repeat(425) {
//try replacing with while (!(!Optical12.color() == red)) {
//CHECKING TO SPIN
if (OpticalSeNoR.color() == red || OpticalSeNoR.color() == orange) {
ROLLERLOL.spin(reverse);
}
else {
ROLLERLOL.stop();
}
wait(5, msec);
}
//Getting ready to shot
Drivetrain.stop();
ROLLERLOL.stop();
Drivetrain.setDriveVelocity(10.0, percent);
Drivetrain.driveFor(reverse, 12, inches, true);
Drivetrain.driveFor(forward,5,inches,true);
Drivetrain.setTurnVelocity(50,percent);
INTAKE1.setVelocity(100,percent);
INTAKE2.setVelocity(100,percent);
INTAKE1.spin(forward);
INTAKE2.spin(forward);
Drivetrain.turnFor(right,180,degrees,true);
Drivetrain.setDriveVelocity(10,percent);
Drivetrain.driveFor(forward,15.45,inches,true);
//Calibrating INERTIAL Thing done above
Drivetrain.setTurnVelocity(10,percent);
Drivetrain.turn(left);
while (true) {
if (InertialTHING.heading(degrees) > 91 && 91.4 > InertialTHING.heading(degrees)) {
Drivetrain.stop();
Drivetrain.driveFor(forward,7,inches,true);
Drivetrain.setDriveVelocity(7,percent);
INTAKE1.stop();
INTAKE2.stop();
Drivetrain.drive(forward);
wait(2.5,seconds);
repeat(425) {
//try replacing with while (!(!Optical12.color() == red)) {
//CHECKING TO SPIN
if (OpticalSeNoR.color() == red || OpticalSeNoR.color() == orange) {
ROLLERLOL.spin(forward);
}
else {
ROLLERLOL.stop();
Drivetrain.stop();
}
wait(5, msec);
}
Drivetrain.stop();
ROLLERLOL.stop();
//MAINFLYWHEEL.spin(reverse, 9.5, volt);
Drivetrain.setDriveVelocity(50,percent);
Drivetrain.driveFor(reverse,50,inches,true);
Drivetrain.turn(right);
if (InertialTHING.heading(degrees) > 105 && 105.4 > InertialTHING.heading(degrees)) {
//Shooting the preloads
wait(4, seconds);
ROLLERLOL.stop();
DigitalOutB.set(true);
wait(0.3, seconds);
DigitalOutB.set(false);
wait(4.3, seconds);
DigitalOutB.set(true);
wait(0.3, seconds);
DigitalOutB.set(false);
wait(2.9, seconds);
DigitalOutB.set(true);
wait(0.3, seconds);
DigitalOutB.set(false);
//MAINFLYWHEEL.stop();
}
Drivetrain.setDriveVelocity(5,percent);
Drivetrain.driveFor(reverse,10.2,inches);
Drivetrain.turnFor(right,90,degrees);
Drivetrain.driveFor(reverse,11,inches,true);
Drivetrain.turnFor(right, 50,degrees);
DigitalOutC.set(true);
wait(3,seconds);
DigitalOutC.set(false);
Drivetrain.driveFor(forward,5,inches,true);
}
}
}
edit: code tags added by mods, please remember to use them