I'm new to Arduino (just since yesterday) coming from the PICs world and the MPLAB C compiler.
Just finished my very first schetch, simple as stupid, I wonder if and how there's a way to 'include' a compiled version of another module, to avoid to cut & paste the external source in a new project.
In other words: let's say that in my new project I need the LCD module (library+short code), the RTC module and a temperature sensor module, I have to copy all the three sources or I can just include a compiled version with the three sub-modules, as I was used to do with MPLAB?
Thanks
I will give a look, thanks
Generally that is what libraries are used for. The code from the libraries does have to be compiled along with the sketch, which takes slightly more time, but you have the advantage of having access to the source code in case you want to make modifications or see the details of how the library works.
Rarely see much discussion about pre-compiled binaries outside of someone who is working on a commercial product and does not want to release their source code.
Maybe I undestand (pls consider I'm very new here).
Your are sayng that I can create a library with all the includes and codes that will remain costant (i.e. LCD, RTC...) and then I can include this library in a new project. Is it correct?
if yes, I should look to how to build a library.
Libraries for using Arduino-supported MCUs with many common sensors, RTCs, keypads, displays, motor drivers, radio modules, etc. are already available, are usually reasonably well debugged and usually come with documentation and/or decent test examples.
Try those out before trying to write your own, especially if you are not very familiar with C++.
Agree...
More applicable to the SoC camps (Raspberry Pi) but we Espressif users do fuss often about the ESP32/ESP8266 proprietary binary inclusions.
Tutorial
Writing a Library for Arduino | Arduino Documentation | Arduino Documentation
Personally...
I generally prefer to keep all of my functions, objects, constants in Arduino Program IDE-tabs. That is to say that I maintain the entire /Arduino/libraries directory for only downloaded 3-rd party code.
Keeping one's library/object-code within the Sketch directory allows one to easily Zip that directory for archive purposes or to just eMail a project to a friend or post online: just supply a list of 3rd-party libs that are dependencies.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.