This code is designed to collect data from a Honeywell Magnetometer (models HMC4853/HMC4883L). The serial monitor displays the bit counts from the x, y, and z axes read from the data registers of the magnetometer and converts those counts into a magnetic field value. Since the magnetometer possesses inherent error, this error was found and added to the result to create the compensated magnetic field measurement. Finally, these compensated values were used to calculate the overall vector info. The magnetometer is setup to continuously get magnetic field data for the Arduino to read.
In order for this code to accomplish its purpose, a HMC4853 or HMC5883L magnetometer must be wired to the Arduino:
-HMC5883L breakout board requires only connections to 4 pins: 3v3, GND, and A4 and A5, used for I2C data and clock pins, respectively.
-HMC5843 hybrid circuit requires external components: see datasheet for required capacitors, resistors, and relevant pins of the sensor to make connections. Arduino once again requires the use of the 3v3, GND, A4 and A5 pins.