Hi,
I am trying to create a library that has a header file HX711.h (ADC converter with amplifier for loadcell) and HX711.cpp so that I can write my code on Arduino IDE. I know that Arduino IDE cannot compile .h and .cpp file, right?
My current problem is that, how would I be able to create these two files that I got from the internet? Do I need to download a Cpp compiler (i.e. dev C++, or Bloodshed) and compile the content of two files into .h and .cpp? I am a complete novice learner in Arduino and programming, so I really appreciate any help from you.
When I copied the content of the HX711.h that I got from the internet to the Dev C++ compiler and compiled it, the error said arduino.h no such file in directory. Do you know how to resolve this problem?
Thank you in advance.
Hi
Are you trying to use .h and .cpp files that someone else has written for the Arduino? And you want to write your own sketch that makes use of them?
The Arduino IDE will let you work with them. One way is just to download and copy them into the same folder as your sketch. When you File - Open the sketch in the IDE, it will also open the .h and .cpp as separate tabs.
You can also install the files as a library that you can then use with different programs without having to copy them each time. But could you clarify what you want to achieve?
Regards
Ray
You are right, I am trying to use HX711.h and HX711.cpp files from some one else has written for the arduino. And I am writing a small sketch that "includes" them.
But here is the thing. I cannot download these 2 files directly on the internet, they are not in .h and .cpp format. So I guessed I had to use a c++ compiler, copy the content of these two files into the c++ compiler so that the compiler can save them as .h and .cpp files.
When I used c++ compiler to do that, it could not find the arduino.h header (arduino.h no such file in directory) (probably because I did not set the directory of the arduino.h).
When I tried to look for the arduino.h in my arduino folder where I installed the arduino IDE software, I could not find the arduino.h as well.
Simply put, I just want the 2 HX711.h and .cpp files to work with arduino. And do you know where the arduino.h located? I have searched the whole computer but there is no arduino.h file
Thank you for your response
You can do this with the Arduino IDE, no need for another compiler.
Maybe there are different versions of the library around. This was the first one that came up when I googled "hx711.h":
If this IS the library you want, click on the "download ZIP" link on that page. The zip file will contain a folder called HX711-master. Extract this somewhere, and change the folder name to HX711.
In the Arduino IDE, click on Sketch - Include Library - Add ZIP library. Select the HX711 folder you extracted and click OK. You should get a message saying that the library has been installed. Then if you look under File - Examples, there should be an item for HX711 with an example program in it.
EDIT Latest IDE is less fussy than I remembered about library folder names. You can skip the extract and rename steps above. In Sketch - Include Library - Add ZIP file, just select the HX711-master.zip file directly.
Thank you very much, this really saved me lots of steps