Old code of tutorial I made for BricoGeek in 2011:
http://blog.bricogeek.com/noticias/tutoriales/tutorial-arduino-brujula-digital-con-hmc6352/
Video: https://www.youtube.com/watch?v=RdcCudAJuWQ
It does not work with latest Arduino releases.
Just for reference:)