Servo startup position?

Hello again. sorry if this is a repeated question, but i wanted to know if there was a command that would allow the servo to be set to a different position upon startup but at the same time will not interfere with the button control to set the servo to a different postion. heres my code, and it works well. but i want to add in the feature i described.

#pragma config(Sensor, in1, , sensorReflection)
#pragma config(Sensor, in2, , sensorPotentiometer)
#pragma config(Sensor, dgtl1, , sensorLEDtoVCC)
#pragma config(Sensor, dgtl2, , sensorLEDtoVCC)
#pragma config(Motor, port1, , tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, , tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port3, , tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, , tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port5, , tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port8, , tmotorServoStandard, openLoop)
#pragma config(Motor, port9, , tmotorVexFlashlight, openLoop, reversed)
#pragma config(Motor, port10, , tmotorVex393_HBridge, openLoop, reversed)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

task flash2;
task headlight;

task headlight()
{
while(true)
{
if(SensorValue[in1] > 400)
{
motor[port9] = 127;
}
else
{
motor[port9] = 0;
}
if(vexRT[Btn5D] == 1)
{
motor[port8] = -127;
}
else if(vexRT[Btn5U] == 1)
{
motor[port8] = 127;
}
if(vexRT[Btn8U] == 1)
{
motor[port5] = 63;
}
else if(vexRT[Btn8D] == 1)
{
motor[port5] = -63;
}
else
{
motor[port5] = 0;
}
if(vexRT[Btn6U] == 1)
{
motor[port4] = 21;
}
else if(vexRT[Btn6D] == 1)
{
motor[port4] = -21;
}
else
{
motor[port4] = 0;
}
}
}

task flash2()
{
while(true)
{
if(SensorValue[in2] > 30)
{
SensorValue[dgtl1] = true;
wait1Msec(500);
SensorValue[dgtl1] = false;
wait1Msec(500);
}
else
SensorValue[dgtl1] = false;
}

}

task main()
{
startTask(flash2);
startTask(headlight);
while(1==1)
{
motor[port1] = (vexRT[Ch1] + vexRT[Ch2])/2; // (y + x)/2
motor[port10] = (vexRT[Ch1] - vexRT[Ch2])/2; // (y - x)/2

motor[port2] = (vexRT[Ch4]);
motor[port3] = (vexRT[Ch4]);

if(vexRT[Ch1] ||  vexRT[Ch2] == 0)
{
	SensorValue[dgtl2] = false;
}
else
	SensorValue[dgtl2] = true;
	}

}

you see, i have a servo controlling the potentiometer. but when i start up the robot, it resets the servo to 0 before i press the two postion toggles. what id like is for the servo to match up with the position of:

if(vexRT[Btn5D] == 1)
{
motor[port8] = -127;
}

upon startup, but i dont know if any code that could be used to do such would interfere with the entire setup of:

if(vexRT[Btn5D] == 1)
{
motor[port8] = -127;
}
else if(vexRT[Btn5U] == 1)
{
motor[port8] = 127;
}

please reply if you can help me with this

It looks like you want the servo at -127 unless button 5U is pressed. If that is the case:


if(vexRT[Btn5U] == 1)
{
motor[port8] = 127;
}
else
{
motor[port8] = -127;
}

The servo would twitch to 0 at the first run of the loop, then drive to -127 as soon as it encounters that if statement.

It would also be wise to set those positions at 120 or less. The very extremes may not be physically possible for the motor to drive to.