Flywheel speed toggle - EasyC V4

I am wondering how I would program a toggle switch with a button. I need the toggle switch to change between speed for our flywheel.
(Ex. Speed 45 - Speed 75)

*I’m also do not have.a program at the moment.

Thank you!
Ry1011

I am not quite sure how to accomplish this in Easy C, but in Robot C you can set a target speed on a button.
Ex.
//Flywheel Velocity Code

	//Full field shot
	if (vexRT[Btn5D]==1){
		targetSpeed= 62;
		flyOn=true;
	}
	//Half field shot
	else if(vexRT[Btn5U]==1){
		targetSpeed=52;
		flyOn=true;
	}
	//No shot
	else if (vexRT[Btn6U]==1){
		flyOn=false;
	}

In our PID code we request the target value and change it in user control. We start our PID and Velocity calculation tasks before our main while statement in driver. Target speed is a global variable.

Assuming you have 4 motors on your flywheel, you would do joystick digital to motor 8 times, setting the 4 of them to 40 speed, and the other 4 to 75 speed. Then, you would change the channel for 4 of them to channel 8 button 1, and the other 4 to channel 8 button 2. This way, when you press button 1 it will go to 40 speed, and when you press button 2 it will go to 75 speed.

In your case you’ll need to set up a variable which changes the speed the motor is at. Pressing F6 will display a window that allows you to define variables in the bottom list. In the ‘Type’ field, select ‘int’. Next, name your variable something short and understandable, such as “flySpeed”. The motors will always run at flySpeed, so when you change the value of flySpeed the motors will also change their values accordingly. You’ll also have to set up another variable that responds to you pressing the button to increase or decrease the flywheel speed. In the pictures below, there’s 2 different ranges called longRange and midRange (It might be useful to have an off button. It works the same way as adjusting the ranges, just set up another variable for it. Inside the if statement set the motor value to 0). The images attached show everything you need to set up this program. If your flywheel starts up automatically with the motor module blocks, the value in the F6 window will be the value it runs at initially. You will have to adjust the values that the flywheel change to in the if statements and the joystick configuration, as these are just examples. If you have any more questions feel free to ask!