I’m working on a wearable project that requires me to be able to detect where north is, in relation to my Particle Photon (Or Electron - I’m working on the photon for now, but I’m planning on porting it to an Electron eventually).
I have an HMC5883L breakout but there are 2 issues:
I can’t be able to find a library that works for it.
Even if I do - from looking at outputs of this breakout, I don’t know how to convert that information to a direction.
Any suggestions on how I can proceed? I’m not married to the 5883 if you have other ideas on how to do this.
If that library does not work then let me know because I got this library working with the Photon.
The compass only really works well if it's completely flat if you tilt it in any direction it throws off the reading pretty good which is frustrating.
Hopefully, it works better for you, but I find these hard to use. My goal was also to find true north but all the compasses I have tried were not stable enough.
I’ve been trying to use the Adafruit library but it won’t compile.
In file included from /src/heaters_v2.cpp:2:0:
lib/Adafruit_HMC5883/src/Adafruit_HMC5883.h:113:10: error: conflicting return type specified for 'virtual void Adafruit_HMC5883_Unified::getEvent(sensors_event_t*)'
void getEvent(sensors_event_t*);
^
In file included from lib/Adafruit_Sensor/src/Adafruit_Sensor/Adafruit_Sensor.h:1:0,
from lib/Adafruit_HMC5883/src/Adafruit_HMC5883.h:28,
from /src/heaters_v2.cpp:2:
lib/Adafruit_Sensor/src/Adafruit_Sensor/…/Adafruit_Sensor.h:149:16: error: overriding 'virtual bool Adafruit_Sensor::getEvent(sensors_event_t*)'
virtual bool getEvent(sensors_event_t*) = 0;
^
/src/heaters_v2.cpp: In function ‘void setup()’:
/src/heaters_v2.cpp:16:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
int onOff;
^
/src/heaters_v2.cpp: In function ‘int heat(String)’:
/src/heaters_v2.cpp:39:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
^
/src/heaters_v2.cpp:54:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
^
/src/heaters_v2.cpp:67:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
int wasFound = searchArray(onOff);
^
/src/heaters_v2.cpp: In function ‘int searchArray(int)’:
/src/heaters_v2.cpp:91:51: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Try to compile using the WebIDE but compile for firmware 0.6.0 instead of 0.6.1. That may help since 0.6.1 is having issues with libraries that normally compile just fine.