GithubHelp home page GithubHelp logo

adafruit_hmc5883_unified's Issues

Missing file

Need help to fix this problem.
The file "magsensor.ino" exists and so does the file "Adafruit_Sensor.h"

Here is the console log for the problem

C:\Users\Administrator\Desktop\Adafruit_HMC5883_Unified-master\examples\magsensor\magsensor.ino:33:29: fatal error: Adafruit_Sensor.h: No such file or directory

#include <Adafruit_Sensor.h>

                         ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

error compiling for esp32 in arduino ide

  • Arduino board: ESP32-WROOM-32

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.19

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): here is a log of the compilation error:
    C:\Users\danda\OneDrive\Documents\Arduino\libraries\Adafruit_HMC5883_Unified-1.2.2\Adafruit_HMC5883_U.cpp: In member function 'void Adafruit_HMC5883_Unified::read()': C:\Users\danda\OneDrive\Documents\Arduino\libraries\Adafruit_HMC5883_Unified-1.2.2\Adafruit_HMC5883_U.cpp:112:60: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: Wire.requestFrom((byte)HMC5883_ADDRESS_MAG, (byte)6, true); ^ In file included from C:\Users\danda\OneDrive\Documents\Arduino\libraries\Adafruit_HMC5883_Unified-1.2.2\Adafruit_HMC5883_U.cpp:38: C:\Users\danda\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire\src/Wire.h:126:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int, int)' uint8_t requestFrom(int address, int size, int sendStop); ^~~~~~~~~~~ C:\Users\danda\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire\src/Wire.h:122:12: note: candidate 2: 'size_t TwoWire::requestFrom(uint8_t, size_t, bool)' size_t requestFrom(uint8_t address, size_t len, bool stopBit); ^~~~~~~~~~~ C:\Users\danda\OneDrive\Documents\Arduino\libraries\Adafruit_HMC5883_Unified-1.2.2\Adafruit_HMC5883_U.cpp:112:60: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: Wire.requestFrom((byte)HMC5883_ADDRESS_MAG, (byte)6, true); ^ In file included from C:\Users\danda\OneDrive\Documents\Arduino\libraries\Adafruit_HMC5883_Unified-1.2.2\Adafruit_HMC5883_U.cpp:38: C:\Users\danda\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire\src/Wire.h:126:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int, int)' uint8_t requestFrom(int address, int size, int sendStop); ^~~~~~~~~~~ C:\Users\danda\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire\src/Wire.h:121:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint16_t, uint8_t, uint8_t)' uint8_t requestFrom(uint16_t address, uint8_t size, uint8_t sendStop); ^~~~~~~~~~~ C:\Users\danda\OneDrive\Documents\Arduino\libraries\Adafruit_HMC5883_Unified-1.2.2\Adafruit_HMC5883_U.cpp:112:60: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: Wire.requestFrom((byte)HMC5883_ADDRESS_MAG, (byte)6, true); ^ In file included from C:\Users\danda\OneDrive\Documents\Arduino\libraries\Adafruit_HMC5883_Unified-1.2.2\Adafruit_HMC5883_U.cpp:38: C:\Users\danda\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire\src/Wire.h:126:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int, int)' uint8_t requestFrom(int address, int size, int sendStop); ^~~~~~~~~~~ C:\Users\danda\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire\src/Wire.h:120:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint16_t, uint8_t, bool)' uint8_t requestFrom(uint16_t address, uint8_t size, bool sendStop); ^~~~~~~~~~~ C:\Users\danda\OneDrive\Documents\Arduino\libraries\Adafruit_HMC5883_Unified-1.2.2\Adafruit_HMC5883_U.cpp:112:60: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: Wire.requestFrom((byte)HMC5883_ADDRESS_MAG, (byte)6, true); ^ In file included from C:\Users\danda\OneDrive\Documents\Arduino\libraries\Adafruit_HMC5883_Unified-1.2.2\Adafruit_HMC5883_U.cpp:38: C:\Users\danda\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire\src/Wire.h:126:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int, int)' uint8_t requestFrom(int address, int size, int sendStop); ^~~~~~~~~~~ C:\Users\danda\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire\src/Wire.h:119:12: note: candidate 2: 'size_t TwoWire::requestFrom(uint16_t, size_t, bool)' size_t requestFrom(uint16_t address, size_t size, bool sendStop); ^~~~~~~~~~~ C:\Users\danda\OneDrive\Documents\Arduino\libraries\Adafruit_HMC5883_Unified-1.2.2\Adafruit_HMC5883_U.cpp:112:60: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: Wire.requestFrom((byte)HMC5883_ADDRESS_MAG, (byte)6, true); ^ In file included from C:\Users\danda\OneDrive\Documents\Arduino\libraries\Adafruit_HMC5883_Unified-1.2.2\Adafruit_HMC5883_U.cpp:38: C:\Users\danda\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire\src/Wire.h:126:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int, int)' uint8_t requestFrom(int address, int size, int sendStop); ^~~~~~~~~~~ C:\Users\danda\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\Wire\src/Wire.h:124:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t, uint8_t)' uint8_t requestFrom(uint8_t address, uint8_t size, uint8_t sendStop); ^~~~~~~~~~~

Description of functions?

Is there a description of the functions of this library besides the example? I appreciate your effort creating this library, but there should be a description of what the functions are in a readme file.

No need to wait for Wire.available().

After Wire.requestFrom() there is not need to wait for data like this : "while (Wire.available() < 6);".
When the Wire.requestFrom() returns, the I2C transmission has completely finished.

There is also a Wire.endTransmission() after a Wire.requestFrom(), that Wire.endTransmission() does not belong there.

A test for the return value of Wire.endTransmission can be used to detect if the device is detected. Also the return value of Wire.requestFrom can be tested to detect a collision in a multi-Master bus.

Incorrect Z scale factor on +/- 4.7G range

In Adafruit_HMC5883_Unified::setMagGain() the Z scale factor for the +/- 4.7 G range is set as 255
This seems to be a typo - it should be something like 355

This also brings up the question of why XY and Z axes have different scale factors. The data sheet says nothing about this and the scale factors in the data sheet are not the same as in the code. Has the author of the code done their own calibration ? Or is the code for an earlier version of the chip?

The "begin" function always returns TRUE

This function apparently means to detect whether an HMC5883 device is detected, and if no device is detected, to trigger the "Ooops, no HMC5883 detected ... Check your wiring!" message in the Adafruit sensor initialization example code. It does not. As written, the function must always returns TRUE.

bool Adafruit_HMC5883_Unified::begin()
{
  // Enable I2C
  Wire.begin();

  // Enable the magnetometer
  write8(HMC5883_ADDRESS_MAG, HMC5883_REGISTER_MAG_MR_REG_M, 0x00);

  // Set the gain to a known level
  setMagGain(HMC5883_MAGGAIN_1_3);

  return true;
}

Value doesn't change

Used this library with a HMc5883L board but it always shows the same.
I have no option to set the i2c bus pins

Missing gain setting (0.88 G)

The code does not support the 0.88 G setting.
I've added it myself and it seems to work.
Is there a reason it's missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.