How to add a library to Arduino using Linux

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

How to add a library to Arduino using Linux

Postby ldouble_e » Thu Aug 19, 2010 11:13 pm

If you are running arduino-0017 on a Linux system (Ubuntu 10.04 is what I'm using) and having trouble adding a library, this is for you. This is how to install the IRremote library for infrared receivers (as an example). http://github.com/shirriff/Arduino-IRremote

    1. Start by navigating to the sketchbook folder. For me the path is /home/username/sketchbook or click Places>home folder>sketchbook
    2. Create a folder called "libraries"
    3. Enter the libraries folder and create the new library name, for example "IRremote"
    4. Now open your favorite text editor and click file>save as..
    5. navigate to the IRremote folder and change the title of the file to be saved from untitled to IRremote.cpp and press save
    6. In your browser open the file IRremote.cpp from the url above.
    7. Copy and paste the code into your text editor and click save in the editor.
    8. repeat steps 5 through 7 for all files. Be sure to change the file extension each time so you are saving as .cpp, .h, and .txt
    9. Once you are done restart the Arduino IDE
    10. To verify everything worked, in the Arduino IDE select sketch>import library and you should see your new library in the list under "Contributed"
    11. Now go to File>Sketchbook>libraries>IRremote>IRrecord and open IRrecord.
    12. Press the verify button and it should compile with no errors.

Now you should be able to add any library you choose. I did this for anyone who is having difficulty getting their new library to show up in the import library menu. I was adding the library to arduino-0017/hardware/library folder which is incorrect unless you are running v0016.
ldouble_e
 
Posts: 4
Joined: Sun Jun 20, 2010 8:41 pm

Re: How to add a library to Arduino using Linux

Postby kokopellix » Wed Nov 16, 2011 1:55 pm

Idouble_e:

I am new to Ubuntu and am using Ubuntu 11.10.

I cannot even figure out how to navigate to 'places'. I have 'Find files' and this allows me to examine the Arduino IDE files. But, I can't find a sketchbook.

I do see a file 'libraries' that contains everything I see when I click on Import Library in the IDE.

I have added the file AFMotor to the 'libraries' file but it does not seem to be accessible to the IDE.

I note that I added the same file to the Windows XP Professional (x64) 'libraries' and my sketches can access it and it shows up when I click on Import Library.

Any idea what I am doing wrong in Ubuntu?
kokopellix
 
Posts: 4
Joined: Sat Oct 15, 2011 11:12 am

Re: How to add a library to Arduino using Linux

Postby keeper » Wed Jun 13, 2012 7:53 am

download the library. Uncompress it. there will be 3 files. *.cpp, *.h, *.txt . copy them to /usr/share/arduino/libraries/ .
e.g. sudo cp *.cpp *.h *.txt /usr/share/arduino/libraries/

restart arduino and everything should work fine.
User avatar
keeper
 
Posts: 1
Joined: Wed Jun 13, 2012 7:46 am

Re: How to add a library to Arduino using Linux

Postby adafruit » Thu Jun 14, 2012 11:11 am

keeper wrote:download the library. Uncompress it. there will be 3 files. *.cpp, *.h, *.txt . copy them to /usr/share/arduino/libraries/ .
e.g. sudo cp *.cpp *.h *.txt /usr/share/arduino/libraries/

restart arduino and everything should work fine.


this is not a good idea, please do not suggest people do this. libraries should be kept in their parent folders
User avatar
adafruit
 
Posts: 10489
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc


Return to Arduino

Who is online

Users browsing this forum: ThisNerdyGuy and 10 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [102]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[109]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]