Autonomous Flywheel Shooting Code

I am trying to get an autonomous function to allow my flywheel to first run for 1.5 seconds(to get to full speed) and then activate my indexer, but I’m not really sure how to do that.

This is what I have right now:

void shoot(double rotations, int speed, double rotations1, int speed1)
{
  flywheel1.spinFor(rotations, rotationUnits::rev, speed, velocityUnits::pct, false); //2 motor flywheel
  flywheel2.spinFor(rotations, rotationUnits::rev, speed, velocityUnits::pct, true);
  wait(1.5, sec);
  rolltake.spinFor(rotations1, rotationUnits::rev, speed1, velocityUnits::pct, true);  //rolltake is indexer
}

How would I make it so that when I call the “shoot” autonomous function it allows the flywheel to run for 1.5 seconds and then spin the indexer to shoot the discs? And how would I make the flywheel1 and 2 spin for a certain amount of seconds rather than rotations?

If you don’t care about your flywheel control method, then just use the spin method.
Your code will look like

flywheel1.spin(fwd, 75, velocityUnits::pct);
flywheel2.spin(fwd, 75, velocityUnits::pct);
wait(1.5, sec);
rolltake.spinFor(fwd, 75, deg);
1 Like