Hitachi HM55B Compass Module Magnetic Sensor Help

Hello,

I would like to use this compass module to determine the location of a magnet that could be housed in one of 5 positions in a circle around the sensor. All of the documentation I find online is either very hard to interpret/not functioning anymore. Wiring shouldn't be too difficult and I found some diagrams, but its the code that I'm struggling to formulate (newbie). Any help would be appreciated!

Thanks in advance

It may not even be possible. Compass modules are designed to detect the Earth's magnetic field, which is very weak. The HM55B has linear response in the range of 0 to 180 microTesla, and even a small magnet can have field strength several orders of magnitude larger than that.

Edit: I have seen some compass modules get "stuck" in high magnetic fields and don't function at all until reset.