How to callibrate a vex Gyro

Hello! I am currently a programmer on team 195a and we are prepping for this next season. I am currently programming the encoders on our robot and realized that I don’t know how to calibrate a vex gyro. I am using Robot C and I was wondering if anyone could help me with this. This is what my code currently looks like for gyros.

void pre_auton()
{
bStopTasksBetweenModes = true;

SensorType[gyroW] = sensorGyro;
wait1Msec(2000);
SensorScale[gyroW] =

}

while(SensorValue[gyroW] < deg120)
	{
		pivot(127);
	}

int deg45 = 450;

int deg90 = 900;

int deg120 = 1200;

int deg180 = 1800;

Essesntially I’m asking how to get the gyro scale. Thanks.

I recommend taking a look at the examples of gyro usage in the RobotC documentation.

For applications, you should take a look through the forums, especially to the NBN season as there have been many examples of gyro applications there.

It’s possible by ‘calibrate’ you were looking to do something like this:
(From the RobotC example file)

//Completely clear out any previous sensor readings by setting the port to "sensorNone"
SensorType[in8] = sensorNone;
wait1Msec(1000); 
//Reconfigure Analog Port 8 as a Gyro sensor and allow time for ROBOTC to calibrate it
SensorType[in8] = sensorGyro;
wait1Msec(2000);

If turning the robot an entire 360 produces a number not close to 3600, then scale should be set to something. Default is 260 it seems, but bump it up or down until turning the robot gets you 3600 (or 0 if it rolls over).