Sketch for HMC5883 3-axis Mag sensor use with Mega 2560 R3

Hello.

Back to trying to use my Mega after some years' absence from Arduino (= I've forgotten all I knew which wasn't a lot in the first place!). Therefore need advice.

At this point I would like to find a simple sketch that the Mega can use to read data from the Mag sensor.

All I want is to be able to print the data to the screen to get an idea how / if that sensor will work. I don't need anything more from it than that at present, and I'm not trying to make a compass anyway!

Have tried to find same but cannot. Tried to use a sketch for the Uno but that doesn't work and I don't know how to alter it for the 2560. In short, I don't really understand what I'm doing!!

I'm a very experienced hardware man (retired) so the wiring is correct. I've downloaded the latest Arduino IDE. But I'm now at a dead end.

Views, wisdom, etc, respectfully sought.

Thanks.

John

XX22XX22:
... the Mag sensor.

:-\

Thanks very much for your kind reply. It was most helpful!

Guys....

Can anyone please point me in the direction of a basic sketch that will allow my Mega 2560 to run the HMC5883L 3 axis magnetic sensor?

I need to kick-start the project by trialing the '5883L.

Thanks.