finding a library

Hi

I have the compass sensor HMC5883L

I want the library for it, and simply have no idea how to find it. Can anyone help pls?

John

Google “hmc5883l arduino library”. 11,000+ hits.

Yes I have done ad nauseam. I am looking for a zip file I can load into my program as per the instructions.

fyi

https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/HMC5883L

all I see here is sample code. I thought libraries gave you new functions with hidden code behind them??

John

The .cpp and .h file on that github link are the library. The author has included them in a much larger collection of libraries, but you can copy and paste just those two files into files on your machine. Put them in a folder called HMC5883L and then add them into the Arduino IDE - click on Sketch - Import Library - Add Library.

You could also include the example program in a subfolder inside the HMC5883L library folder. It will then show up in File - Examples.

Hey thanks for that. When you know nothing, nothing is obvious! John

OK Now I am home and trying to do what you suggested. When the page comes up I see the two files. How do I copy them? I can open them, but there is no way to save as.. I copied the code into arduino and tried to save as a cpp file, but it won't let me do that. Once again.. no idea..

John

Couple of ways.

Using a text file editor (like Notepad or Notepad++), copy the file contents from the web page and paste into the editor. Then save as either .cpp or .h as appropriate.

The other way is to navigate up the folder structure on that GitHub page. The author has put this library in with a whole bunch of others in the same GitHub repository. When you get to the top level of the repository, there will be an option to download as zip. You could then drill down into the zip and copy the folder and files you need.

Or go to - GitHub - jrowberg/i2cdevlib: I2C device library collection for AVR/Arduino or other C++-based MCUs -
on the right side there is “Download as zip file” and you have them all to extract as you please.