Vex v5 motors speed

I tried to choose a speed for my motor. The motor moves when I press specific keys on the controller as shown in my code. But sometimes when I run the program on the brain and try to move the motor with the button on the controller, it moves very slowly for a little and suddenly becomes faster, or it moves fast then becomes slow. Also sometimes it moves slowly the whole time the program is running but when I turn it off and on many times it changes its speed.

I am asking what could the problem be, is it the code or what exactly?

4658790

Need to see more/all code. In your code so far… you’ve got 2 buttons doing the exact same thing.

Motors initially turn on, if not specified, at approx 40-50% speed.

My bet is it’s a code problem.