Vex Gyro Initialization

Hi everyone! I was researching how to use the vex Gryo, and have come across some code that is partly confusing me. What is the difference between code like this:


//reinitialize gyro
SensorType[in8] = sensorNone;
wait1Msec(1000);

//reassign gyro
SensorType[in8] = sensorGyro;
wait1Msec(2000);

and this:


SensorValue gyroPort ] = 0;

Do they both do the same thing, which is resetting the gyro?

No, your first code snip restarts the GPIO configuration for port in8, and your second code snip sets RobotC’s internal counter of where the gyro is to 0. In other words, the first code snip tells your gyro to recalibrate itself internally, and the second code snip just zeroes out your counter.

Thank you very much @rbenasutti!