Hardware Reference
In-Depth Information
Don't Use External Libraries
If you are writing a library, make sure that it uses only the Arduino standard
libraries, or if absolutely necessary, board-specii c libraries. If you have a great
idea for a function, but one that can run only on an Arduino Esplora, then you
can use the Esplora libraries. However, if it can be used on any Arduino, it would
be a shame to limit it to one device. Similarly, don't rely on third-party external
libraries; you are creating an external library, and users might not want to use
your library if it depends on another one. Importing several libraries makes
the code bigger.
Use Standard Names
Most hardware-related drivers use a begin() function in their code. Don't try
to i nd synonyms; keep the same names as other functions. For example, if
obtaining data, always use read: readInput() or readStatus() . When output-
ting, use write: writeData() .
Distributing Your Library
When the coding is complete and the testing has been done, it is time to
distribute your library. You can create a Zip i le of your library and post it on
your homepage (or the page you use to sell your hardware). This makes the
library available to buyers (or visitors to your site) but does not increase visibility.
To make your library as visible as possible, consider putting it on one of the
many sites designed specii cally for source code, such as Sourceforge, GitHub,
or Google Code. There are dozens of sites available for free, so long as your
project is open source. This also automatically adds your library to search
engines and allows users to help add new features, be alerted to updates, and
make comments and requests.
Closed Source Libraries
A closed source library is one where you distribute binary code, and users are
not allowed to see the source code. They cannot see the work you have done and
therefore cannot modify the library. This also adds the possibility of request-
ing payment for use of your library, but it goes against everything the Arduino
project is trying to do and is also technically extremely difi cult to achieve.
Compilers and linkers take source code and transform it into machine code,
code that can be executed on a microcontroller or processor. This is generally
the format in which closed source libraries are distributed. The problem is that
binary i les are created for one specii c processor and cannot be used on another.
A program compiled for an AVR cannot be run on an ARM-based device such
 
Search WWH ::




Custom Search