Compiling with an external library

I'm doing a university thesis. I would to know how do I include external libraries. I have .h and .c files:

I created the folder "sketchbook/libraries" as required. Here I put my files. Then I included the #include statement in the sketch.
The problem is that libraries have a chain of inclusions of other headers (which are not in /usr/share/arduino/hardware/arduino/cores/arduino) that I have... this library is very huge!

Do you think I can include them manually? If so, where? In the folder of the sketch, or in the installation dir of Arduino?

Thanks!

this library is very huge!

How much of the library are you using? What does the library do?

If the library is "very huge", and you are using any significant amount of it, it is likely that the resulting program won't fit on an Arduino.

I created the folder "sketchbook/libraries" as required. Here I put my files.

Your source files have to be placed into "sketchbook/libraries/".
lets says you named your library "MyFirstLib" then your .h and .c(pp) files have to be installed into "sketchbook/libraries/MyFirstLib"

Eberhard

thank for the answers...

@PaulS: the library is the libmodbus (or i'll try the freemodbus) you can see here: libmodbus in Launchpad
it's 80KB of code, i'll try to select only the code i need.

@wayoda: yes, i did it correctly :wink:

anyway my problem is that library was not written for avr, so it needs other headers file arduino doesn't have... could i copy that files in the project, even if they're not wrtten for avr?

could i copy that files in the project, even if they're not wrtten for avr?

No way! Its written for a processor running Linux. You might study the code for Bus interaction, but it will never run on the Arduino.

Eberhard

ok, so i can take algorithms and logic, but i can't include it as is.

i could extend the modbus sketch by Juan Pablo Zometa jpmzometa with new functions and make a library of it...

thank you.