Just installed a color sorter onto our robot, problems when robot see's red rings, help please

We just installed a color sorter onto our robot, after some programming attempts, we started to run into some problems. upon trying to intake red rings, our robot would repeat our last inputs (eg: turning or driving forwards) at extreme speeds causing our robot to ram itself into walls or spin rapidly upon seeing a red ring. if you know any ways to fix this issue, please help.

Welcome to VexForum!

This is a simplified model of how your code will behave:

Forever:
  Do the 6 Wheel Control Function, Arcade Drive
  ARM function Here
  Consumption function
     Some other code
     Check if R1 is pressed. If yes,
           Is Red detected? If yes,
                   Pause ALL TASKS for 0.8 seconds (nothing in this will run for 0.8 seconds)

This temporarily stops you from changing the motor velocities of your drivetrain for 0.8 seconds, so it keeps going in the same direction and speed.

Instead, you can initiate multiple threads to fix this, so waiting on the “Consumption” function wouldn’t stop the other functions, e.g. “6 wheel control” from working.

Instead of this,

Do This:

Hopefully this will fix your issue. If it still persists, let us know.

As for the extreme speeds, I’m confused on how that could happen…

1 Like