jerdon
June 27, 2024, 4:30am
1
Arduino forum,
I'm using NANO with Arduino 1.8.7. I know this is old stuff but this is on an old laptop and I'm stuck with this version.
I have other sketches working but now I'm trying to include the library Adafruit_HMC5883_Unified and when verifying I get "Adafruit_HMC5883_Unified no such file or directory". If I look in "Manage Libraries" it shows it as "Installed".
I must be missing something.
jerdon
The header file to include is actually called Adafruit_HMC5883_U.h
jerdon
June 27, 2024, 4:53am
3
van_der_decken,
Thanks for the reply.
That worked but that specific name doesn't show up in "Manage Libraries".
jerdon
The name of the library does not always equate with the name of the header file in it that you have to include. With some general purpose libraries, you may even have to select which header file from several in the library to include.
mikedb
June 27, 2024, 5:19am
5
When a Library have Example's , then just open a example and look how the header file is included.
the library has exact one example:
/***************************************************************************
This is a library example for the HMC5883 magnentometer/compass
Designed specifically to work with the Adafruit HMC5883 Breakout
http://www.adafruit.com/products/1746
*** You will also need to install the Adafruit_Sensor library! ***
These displays use I2C to communicate, 2 pins are required to interface.
Adafruit invests time and resources providing this open source code,
please support Adafruit andopen-source hardware by purchasing products
from Adafruit!
Written by Kevin Townsend for Adafruit Industries with some heading example from
Love Electronics (loveelectronics.co.uk)
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
This file has been truncated. show original
load the example and check if it compiles.
if not - post the error messages from the compiler to the forum.
jerdon
June 27, 2024, 5:02pm
7
noiasca,
Thanks for the reply.
I had already found Kevin's program on the internet.
When I first ran Verify/Compile it couldn't locate Adafruit_HMC5883.U.h however it is okay now.
I ran slave_Address and it reported:
0x0D // not sure which one this is.
0x028 // this is probably my BNO055 which works
When uploading the sketch I get the following in a serial monitor.
X: -0.09 Y: -0.09 Z: -0.10 uT
Heading (degrees) 237.61
This reading repeats no matter how I turn the test fixture.
There is a loop function but I'm not too familiar with how a Arduino runs functions.
Any suggestions?
jerdon