Autonomous for moving forward

and yes, go ahead and show me

1 Like

oh I see, thank you!

void forward(int x){
LeftMotor.startRotateFor(vex::directionType::rev, x, vex::rotationUnits::deg);
RightMotor.rotateFor(vex::directionType::fwd, x, vex::rotationUnits::deg);

LeftMotor.stop();
RightMotor.stop();
}

void reverse(int x){
LeftMotor.startRotateFor(vex::directionType::fwd, x, vex::rotationUnits::deg);
RightMotor.rotateFor(vex::directionType::rev, x, vex::rotationUnits::deg);

LeftMotor.stop();
RightMotor.stop();
}

void spinningIntakes(int x){
LeftIntakeMotor.startRotateFor(vex::directionType::fwd, x, vex::rotationUnits::deg);
RightIntakeMotor.rotateFor(vex::directionType::fwd, x, vex::rotationUnits::deg);

LeftIntakeMotor.stop();
RightIntakeMotor.stop();
}

void turningRight(int x){
LeftMotor.startRotateFor(vex::directionType::rev, x, vex::rotationUnits::deg);
RightMotor.rotateFor(vex::directionType::fwd, -x, vex::rotationUnits::deg);

LeftMotor.stop();
RightMotor.stop();
}void forward(int x){
LeftMotor.startRotateFor(vex::directionType::rev, x, vex::rotationUnits::deg);
RightMotor.rotateFor(vex::directionType::fwd, x, vex::rotationUnits::deg);

LeftMotor.stop();
RightMotor.stop();
}

void reverse(int x){
LeftMotor.startRotateFor(vex::directionType::fwd, x, vex::rotationUnits::deg);
RightMotor.rotateFor(vex::directionType::rev, x, vex::rotationUnits::deg);

LeftMotor.stop();
RightMotor.stop();
}

void spinningIntakes(int x){
LeftIntakeMotor.startRotateFor(vex::directionType::fwd, x, vex::rotationUnits::deg);
RightIntakeMotor.rotateFor(vex::directionType::fwd, x, vex::rotationUnits::deg);

LeftIntakeMotor.stop();
RightIntakeMotor.stop();
}

void turningRight(int x){
LeftMotor.startRotateFor(vex::directionType::rev, x, vex::rotationUnits::deg);
RightMotor.rotateFor(vex::directionType::fwd, -x, vex::rotationUnits::deg);

LeftMotor.stop();
RightMotor.stop();
}

fyi, for some reason the left motor is reversed, so I put it as rev, when its supposed to go forward, and vice versa for going backwards

so you should be able to set it to reversed wherever you do the motor set up

1 Like

oh ok, so should I set it as reversed during the pre_auton?

also instead of multiple functions for forward and backward I made mine with 1

void function( int x, directionType ) {
//your code
//minus the motor stops, no need when using rotateFor
//also just get rid of the directionType in the command if I remember correctly
}
1 Like

ooooooooo, that is so much better, thank youuuu

np, don’t have my code with me so I’m trying to do it by what I remember. And I programmed that part a long time ago. There’s also a better way to do turn functions but it’s more complicated

1 Like

oh, is it multitasking using tasks?

no, it uses strings and if statements

1 Like

Oh I know what those are, I learned that in grade 9-10 com sci for python

my functions take a ton of parameters lol

1 Like

I think they all take 4-6

1 Like

ye, but thats just makes it so easy and convenient

wow, thats insane, I can only think of 2 maximum when it comes to auton

i have direction, speed, distance, and blocking on all of them

but I only had to make like 5 functions…so far

never heard of blocking before, what is that?

it’s actually called “waitForCompletion” it tells the program to either wait for the motors to get there, or to move on to the next thing. For instance, if I want to move and raise our angler at the same time, or put the tray down as we back away from the stack.

2 Likes