[#ARDUINO] HowTo: Add external libraries (in the correct way, not using brute force mode like me!)

Good,

today is one of those days where the worst of the day is what comes out of the tip of my fingers. In this case, was trying to create a demo / deploy Arduino script (at Avanade will organize a Coding Dojo by these days) and tell me your head on the wall when trying to add external libraries in an Arduino program.

In reality, and as always, he was following my instinct by hand to add libraries when the process is much simpler.We are on hand to understand how it works the IDE and compiler of Arduino.

If you have installed Arduino in the path by default, you will see that in the folder [C:\Program Files (x 86) \Arduino] there are a number of folders with samples, libraries, etc.

image

When you download an external library to a sensor, one of the options to use it is to copy it inside the libraries folder. Within it we can see the libraries that has by default the IDE to work with some sensors and actors.

image

If we go into one of these folders we will see that in them we have:

  • A folder with examples
  • Cpp and h files in order to use the devices in our programs
  • a file keywords.txt, which I used for the coloring in the Arduino IDE

image

As well, if you decide to work with a sensor that does not come from the factory, it usually you give a ZIP with the same content inside. And of course, the first thing that one who has worked with C++ tends to make is to copy it into the installation directory of Arduino.

image

ERROR! BIG MISTAKE!

The fabulous Arduino IDE has an option to import a ZIP that makes a different work to what I have explained.From the “Sketch / / Import Library / / Add Library” menu we select a ZIP and then see that it is already part of the IDE.

image

However, it is not copied in the folder [C:\Program Files (x 86) \Arduino]. What does the bastard of the IDE is to unpack the ZIPs add content in your folder [My Documents / / Arduino / / Libraries]

image

In this way also you have access to these libraries, unless they are in the installation directory of Arduino (Ricard dropped me this tip, but I was riding one of the monkey to have this organized my way)

image

Saludos @ La Finca

El Bruno

image image image
About these ads

Deja un comentario

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s