I’m using an HMC5883L (L883 chip) sensor, libraries Wire.h, Adafruit_hmc5883_unified and Adafruit_sensor.
I’m working on a compass and trying to calibrate it. Example code gived by the h5883 library works fine and also the other that I’ve made… but… when I unplug the arduino from PC and reconnect, it fails!
When this has happened, I’m able to read an initial value on plug, then it freezes and never updates. After this, if I disconnect from PC move the sensor to a new position and replug again, it reads a new value and freezes again.
By freezing I mean that Serial.print returns the values as suposed to do but it gives always the same value no matter if I move the sensor.
Also I’ve found that if I upload an other different code it starts to work well again, updating and writting values as it is supposed to do. But even with a new code, if I disconnect it goes to the same failing point. Also, if I try to upload a second time the same code that has been loaded before, this won’t change anything, it needs to be different to work again.
Can someone help me before I try to kill myself?!
Have a nice day guys!