|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#3
|
|||
|
|||
|
Re: Off Season Programming Question: Switch Statements
Once I add the while loop will the method I am using for switching between case statements work?
Code:
void Autonomous(void)
{
myRobot.SetSafetyEnabled(false);
while(IsAutonomous && IsEnabled){
switch (step){
case 1:
pid.Enable();
pid.SetTolerance(.1);
pid.SetOutputRange(-.5, .5);
pid.SetSetpoint(497);
if(pid.OnTarget()){
step++;
}
break;
case 2:
pid.Enable();
pid.SetTolerance(.1);
pid.SetOutputRange(-.25, .25);
pid.SetSetpoint(800);
if(pid.OnTarget()){
step++;
}
break;
default:
break;
}
}
}
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|