After trying several pieces of code found on the net, nothing was working on my Raspberry Pi, running Raspbian Stretch and a QMC5883L breakout labeled GY-273.
So I got the Datasheet and I wrote a little Python driver wichi is working quite well for me. You can find it here: https://github.com/RigacciOrg/py-qmc5883l
A very basic usage example is:
Code: Select all
#!/usr/bin/python import time import py_qmc5883l sensor = py_qmc5883l.QMC5883L() while True: print sensor.get_magnet() time.sleep(0.2)