Motor stuttering

I have mad code for a conveyor belt. When going a specific direction it stutters, we have changed the motors and are sure it is a code issue.

if(Controller1.ButtonL2.pressing()){
  //spins other direction
  // find out what problem with reverse is
  conveyor.setVelocity(80,percent);
  conveyor.spin(reverse);
} 
else if(Controller1.ButtonL1.pressing()){
  // strts coveyor spinning
  conveyor.setVelocity(80,percent);
  conveyor.spin(forward);
}
else{
  // stops the conveyor from spinning
  conveyor.spin(forward);
  conveyor.setVelocity(0, percent);
1 Like

try

else {
  // stops the conveyor from spinning
  conveyor.stop();
  }
5 Likes

instead of setting the velocity then spinning, try
conveyor.spin(reverse, 80, percent);
i have had a similar problem, and this fixed it
(you can also replace percent with pct, it does the same thing, but with less typing)

4 Likes