Help with Optical sensor in PROS

I have some code I’ve made to spin my rollers until a color is reached with the optical sensor. The red version seems to work, but the blue doesn’t work very well. Would anyone know what that is?

void RedRoller() {
    optical.set_led_pwm(100);
    while(!(optical.get_hue() > 345) && !(optical.get_hue() < 15)) {
        intake2.move_velocity(-35);
    }
    intake2.move_velocity(0);
}
void BlueRoller() {
  optical.set_led_pwm(100);
    pros::delay(200);
  intake2.move_velocity(-35);
  while(!(optical.get_hue() > 225) && !(optical.get_hue() < 235)) {
    pros::delay(10);
  }
  intake2.move_velocity(0);
}

I would make the range of hue for blue wider. perhaps 200 to 240 degrees.

3 Likes