UNOFFICIAL: How to program different speeds on shooter

This is an unofficial response to @Bearcats post on programming different speeds. Some basic code would look like this:


int targetSpeed = 0;

void flywheel(int speed){
     //function that sets flywheel motors
}
task userControl(){
     while(true){
          if (button A == 1)
               targetSpeed = 50;
          else if (button B == 1)
               targetSpeed = 100;
          else if (button C == 1)
               targetSpeed = 0;

          flywheel(targetSpeed);
     }
}

Some discussion recently in here too:

https://vexforum.com/t/velocity-help/33881/1