How to count full rotations?

hi,

I would like to use a gyrometer and an magnetometer to count full rotations in all three axes.
I found out that the gyrometer drifts over time, thats why I want to use a magnetometer. And the gyro measures only deg/sec. Integration of the gyrometer values is inaccurate. Is there any sample code available? I could not find a tutorial which shows the basics.

Kind regards

https://www.sparkfun.com/tutorials/301

Maybe that will get you started.

Ray