Pages

Ads 468x60px

lundi 26 octobre 2015

Installing Libraries and how to write a Library for Arduino

certamente

Libraries are files written in C or C++ which provide sketches with extra functionality, for example the ability to control an LED matrix, read an encoder, connect to a sensor, display, or module, etc. They are very useful to lower the barriers for creating amazing interactive projects and use a wide range of components.  Libraries can be created by everyone and shared with the open source community!

To use an existing library in a sketch you can use the Library Manager (available from IDE version 1.6.2), open the IDE and click to the “Sketch” menu and then Include Library > Manage Libraries and follow the Guide on this page.

LibraryManager_1-1

 

If you want contribute with a new library for an Arduino or a Genuino board, you are welcome to do so. The best way to start is to learn how to turn a sketch into a library and when you are good at it, learn how to code with basic Arduino principles in mind in order to allow beginners to get started with Arduino easily. Follow the Guidelines at this page, here’s a preview of what you’ve find:

Be kind to the end user. Assume you are writing an API for an intelligent person who has not programmed before. Come up with a clear mental model of the concept you’re working with, and the terms and functions you will use.

Use full, everyday words. Don’t be terse with your function names or variables. Use everyday terms instead of technical ones. Pick terms that correspond to popular perception of the concept at hand. Don’t assume specialized knowledge. For example, this is why we used analogWrite() rather than pwm(). Abbreviations are acceptable, though, if they’re in common use or are the primary name for something.For example, “HTML” is relatively common and “SPI” is effectively the name of that protocol (“serial-peripheral interface” is probably too long). (“Wire” was probably a mistake, as the protocol it uses is typically called “TWI” or “I2C”.)

Avoid words that have different meanings to the general public. For example, to programmers, an error is a notification that something happened. To the general public, errors are bad things.

When you are ready, you can share your new library and documentation on this dedicated area of the Forum.



from Arduino Blog http://bit.ly/1Xu9QHa

0 commentaires:

Enregistrer un commentaire