Vex V5 Flywheel Consecutive shots

Good Morning fellow forum goers, my name is farees and I am the head programmer from the team 200X. We have been using a flywheel for most of the season at this point and we want to take it to the next level by doing consecutive shots to shoot the top then middle flag but i could not figure out how to do it it, any help is appreciated, thanks is advance

I’ve only dabbled in the programming (and I haven’t even touched the looming monster that is V5 coding), but I would say to have your flywheel motor/s speed/voltage on a variable, and choose two buttons on the controller to change the speed of the flywheel gradually (like just the deceleration the flywheel would regularly slow down after the motors shut off would be perfect, and the acceleration the flywheel when the motors first turn on would be perfect to speed it up) If you want to, you might want to have your V5 screen display the motor variable, so the driver has a rough grasp of what power they need/have at one particular moment.

ok i wil try this, thanks for your help

Also it would be really helpful if you could post some pseudo code

All I can do is write an outline for it. (RobotC based format btw, cant do anything else :()

assign variable flywheelspeed

while(true){

flywheelmotorA = flywheelspeed(this might need to be converted into motor talk somehow idk V5 yet)
flywheelmotorB = flywheelspeed
and so on…

while(vexRT[Btn7U] == 1){
flywheelspeed = flywheelspeed + (whatever would be equivalent to the acceleration the flywheel normally spins up at)
}
while(vexRT[Btn7D] == 1){
flywheelspeed = flywheelspeed - (whatever would be equivalent to the deceleration the flywheel normally winds down at)
}
(you might need an if statement for if both of the buttons aren’t being pressed or if both of them are being pressed in order for this to work, but you will have to test that.)
}

This code might completely fail (someone pls check me on this), but from how I see it, this basic outline should work for how it is supposed to work.
Oh and if you want the normal toggle to speed the flywheel up at the start(and to stop it), just add that at the start of the while true loop and change the variable for flywheelspeed instead of the motor/s speed itself.

I haven’t tested this yet, but you could also make it fully autonomous by having the motors spin up to the correct speed, fire, spin to the lower speed, and then fire again.

something like this in a task that runs if you press a button:

Flywheel.move_velocity(targetHigh); //run flywheel at speed necessary to hit top flag
while(abs(Flywheel.get_actual_velocity()-targetHigh) > threshold){} //wait until flywheel reaches that speed
intake.move(100); //fire ball
while(abs(Flywheel.get_actual_velocity()-targetHigh) < threshold){} //wait until ball shoots and flywheel speed decreases
Intake.move(0); //stop intake
Flywheel.move_velocity(targetLow); //run flywheel at speed necessary to hit middle flag
while(abs(Flywheel.get_actual_velocity()-targetLow) > threshold){} //wait until flywheel reaches that speed
intake.move(100); //stop intake
while(abs(Flywheel.get_actual_velocity()-targetLow) < threshold){} //wait until ball shoots and flywheel speed decreases
Intake.move(0); //stop intake
Flywheel.move_velocity(0); //stop flywheel

I haven’t tested this, so it could be completely wrong and cause the robot to explode for all I know.

@Crazycrabman #relatable