Measuring dynamic pitch

This is how I implemented the angle from the gyroscope:

gyrovolt = gyroavg*5/1023;
ygyro = -((gyrovolt-gyrooff)/gyrosens); 
if (ygyro > -1.2 && ygyro < 1.2){
ygyro = 0;
}
time = (millis()-first_time)/1000;
first_time = millis();
anglegyro = anglegyro + ygyro*time;

I'll look up the Kalman filtering.