Calculating heading using gyroscope