Boost and slow down buttons (RobotC programming beginner )
I’m new to programming in C language and I need some help with our flywheel code.
So we have 6 motors on one flywheel and we want manual control of the speed of the flywheel.
So how do I set my motors to a certain speed(power value) during the start of the match and then have a button on the remote which boosts the speed by 5 each time the button is pressed and another button which decreases the speed by 5 during driving period?
We want the boost buttons to keep the flywheel spinning at the same speed and if power drops, we can manually add a little boost to it by pressing a button.
here is what the code looks like:
#pragma config(Motor, port1, BtmIntake, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, LeftDrive, tmotorVex393HighSpeed_MC29, openLoop)
#pragma config(Motor, port3, LBtmL, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, LMidL, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port5, RMidL, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, RBtmL, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port7, RUpL, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port8, LUpL, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, RightDrive, tmotorVex393HighSpeed_MC29, openLoop, reversed)
#pragma config(Motor, port10, UpIntake, tmotorVex393_HBridge, openLoop)
void flywheel (int speed)
{
speed=0;
motor[LBtmL]= speed;
motor[LMidL]= speed;
motor[LUpL] = speed;
motor[RBtmL]= speed;
motor[RUpL] = speed;
motor[RUpL] = speed;
}
task main ()
{
flywheel (60);
if(vexRT[Btn7U] == 1)
{
{
flywheel (+5);
}
}
if(vexRT[Btn7R] == 1)
{
{
flywheel (-5);
}
}
}