About HMC5883L library and functions need help please

Hi,
I got two libraries for HMC5883L A & B. A used compass.begin() and with functions such as: compass.setOffset(0, 0); to set compass calibration offset.
B used compass.initialize(); , with function such as: compass.getHeading(&mx, &my, &mz);.

How to use B with the function of compass.setOffset(0, 0);
OR use A with the function of : compass.getHeading(&mx, &my, &mz);.

I'd tendency to use B. Do I have to edit the library like to copy class from A to B?
Thanks
Adam

links to those two libraries? There are multiple libraries available. It is usually best to stick to just one. They should both have the same basic functionality.

1 Like

Thanks.
I forget the original link of them, attached files OK?
A:
HMC5883L.cpp (5.8 KB)
HMC5883L.h (3.2 KB)
B:
HMC5883L.cpp (14.4 KB)
HMC5883L.h (4.8 KB)

I would go with your version A library. Library B uses the I2Cdev.h library for i2c transmission rather than the standard Wire library. I am not a fan.

I'm sure either will work so just pick one and use it.

1 Like

Thank you.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.