Yaw rate gyroscope problem

I mounted a gyroscope onto my robot but it always moved a few degrees to much.
At first I mounted it at 45 degrees and the robot seemed to move 45 degrees to much.
When I put the gyro level in the center of the robot it only moved a few degrees to much.
What did I do wrong?
thank you for responding!!:grin::+1:

Read up on the great information they provide regarding drift due to vibration and scaling…

I checked out your post and it was very helpful.
However, this is my first year doing vex and I am just learning coding.
I am using VCS and I was wondering if you had any example code for the gyro in this studio.

The code I have now looks like this. I don’t know How to calibrate it.
And this is in the autonomous section
Gyroo is the gyro name.

Also,I was wondering if you could use a gyro to move straight forward .

Thanks For Replying:exclamation::bangbang::+1:

I don’t use VCS, but your code looks comparable to what @jpearman ok’d in this link Another question, How do I properly use the Gyro sensor. Also, according to his info in that link it looks like maybe the gyro automatically calibrates in VCS at the start?