Go Down

Topic: Where do I put extra libraries? (Read 820 times) previous topic - next topic

AverageGuy

The page at http://www.arduino.cc/en/Hacking/Libraries says to  put them in a sub-sub directory of your sketchbook.  My sketches are in ~/sketchbook so I created a ~/sketchbook/Arduino/libraries as suggested and put them there.  They aren't found.  I'm running 0022 on Linux. 

Also I'm using the MsTimer2 library and it says "Install it on {arduino-path}/hardware/libraries/" but there is no such library.  Yes, I did restart the ide after creating the path and moving the libraries to the new path.
Code: [Select]

jim@blackie:~$ cd ~
jim@blackie:~$ ls sketchbook/Arduino/libraries
Bounce MemoryFree  MsTimer2


This all worked OK on 0018.  I hate it when people fix things that aren't broken.
Thanks, Jim.

CrossRoads

Part of the Arduino install file structure is a libraries folder already, they need to go in there.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

AverageGuy

I tried that first, but I don't think I restarted the ide.  I'll try again.

Thanks,
Jim

retrolefty

#3
Aug 19, 2011, 10:29 pm Last Edit: Aug 19, 2011, 10:32 pm by retrolefty Reason: 1

Part of the Arduino install file structure is a libraries folder already, they need to go in there.



The main problem is that the normal installation of Arduino does not create a folder named libraries in the users sketch folder upon installation of the IDE, for storing contributive libraries. The user has to do that manually and place any desired 3rd party library folders into it. This is where the arduino IDE looks for any 3rd party contributed library files one wants included in your main sketch, using the sketch/import Library menu. The Arduino handles well the finding and including any of the arduino 'core' library files, but the how and use of the 'Contributed' library folder and files is not real clear to newcomers.

This facility was only added around version 11 or 12 (I think) and was very welcomed. Prior to that one had to add any desired 'contributed' libraries into the Arduino 'core' library folder and when one upgraded the arduino version distribution all libraries added would be lost after installation of the new IDE.

So it's a very nice feature, but not clearly explained well enough for newcomers to the Arduino platform in my opinion.

Lefty


CrossRoads

So where should I put my SdFat and Virualwire libraries?
They seem to work ok from the Core libraries location:
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

retrolefty

#5
Aug 20, 2011, 08:17 am Last Edit: Aug 20, 2011, 08:20 am by retrolefty Reason: 1

So where should I put my SdFat and Virualwire libraries?
They seem to work ok from the Core libraries location:



They will work from there, and that was where one had to put them prior to some past IDE version (12?), however the down side is when you go to download and install the next new version of the IDE it will not include any library files you have loaded, so you will have to remember that you have manually move them over to be able to use them in the new IDE version. The advantage to storing them in the arduino users sketch directory, inside a folder named libraries, is that those folder directories are not effected by uploading a new IDE version or even just reinstalling a existing IDE version.

That make sense?

CrossRoads

"arduino users sketch directory"
Okay, so I have a folder called
c:\Users\Owner\Documents\Arduino & Firefly files\  where my sketches end up

You are saying I should add a folder there
c:\Users\Owner\Documents\Arduino & Firefly files\libraries

and put Virtualwire, etc there?
How do I make -0021 and -0022 look there instead?

This file c:\Users\Owner\AppData\Roaming\Arduino\preferences.txt does not appear to  have a library reference in it.
Code: [Select]

export.application.fullscreen=false
preproc.imports.list=java.applet.*,java.awt.Dimension,java.awt.Frame,java.awt.event.MouseEvent,java.awt.event.KeyEvent,java.awt.event.FocusEvent,java.awt.Image,java.io.*,java.net.*,java.text.*,java.util.*,java.util.zip.*,java.util.regex.*
editor.font.macosx=Monaco,plain,10
preproc.web_colors=true
last.sketch2.path=C:\Users\Owner\Documents\Arduino & firefly files\Serial_ports_test_1284\Serial_ports_test_1284.pde
export.application.platform=true
update.check=true
default.window.width=500
update.id=2768915128608143186
editor.indent=true
serial.stopbits=1
serial.databits=8
editor.font=Monospaced,plain,12
editor.window.height.default=600
run.options.memory=false
preproc.imports=java.applet,java.awt,java.awt.image,java.awt.event,java.io,java.net,java.text,java.util,java.util.zip,java.util.regex
editor.divider.size=2
default.window.height=600
editor.caret.blink=true
preproc.color_datatype=true
export.applet.separate_jar_files=false
last.sketch3.path=C:\Users\Owner\Documents\Arduino & firefly files\Finals_Strip_test_of_max6953_slimmed\Finals_Strip_test_of_max6953_slimmed.pde
preproc.output_parse_tree=false
run.window.bgcolor=#F0F0F0
console.lines=4
upload.using=bootloader
console.error.file=stderr.txt
run.options.memory.maximum=256
editor.tabs.expand=true
editor.window.height.min=530
editor.keys.home_and_end_travel_far=false
board=atmega1284p
console=true
run.present.exclusive.macosx=true
last.sketch4.path=C:\Users\Owner\Documents\Arduino & firefly files\countup_timer\countup_timer.pde
serial.parity=N
editor.tabs.size=2
console.length=500
last.sketch0.location=440,150,500,600,418
serial.port=COM12
last.sketch2.location=769,27,500,600,418
run.options=
console.auto_clear=true
update.last=1313822301454
last.sketch4.location=-8,-8,1296,786,604
editor.window.width.min=400
run.present.exclusive=false
export.application.platform.linux=true
editor.keys.home_and_end_travel_far.macosx=true
editor.window.height.min.windows=530
run.present.bgcolor=#666666
export.application.platform.windows=true
target=arduino-extras
run.options.memory.initial=64
editor.keys.alternative_cut_copy_paste=true
editor.window.width.default=500
console.output.file=stdout.txt
preproc.substitute_unicode=true
run.present.stop.color=#cccccc
editor.external=false
last.screen.height=800
editor.keys.shift_backspace_is_delete=true
editor.window.height.min.macosx=450
last.sketch.count=0
export.delete_target_folder=true
last.sketch0.path=C:\Users\Owner\Documents\Arduino & firefly files\Blink_test_all_1284\Blink_test_all_1284.pde
last.serial.location=724,85,466,508
preproc.substitute_floats=true
editor.keys.alternative_cut_copy_paste.macosx=false
serial.line_ending=0
browser.linux=mozilla
editor.invalid=false
serial.debug_rate=9600
sketchbook.path=C:\Users\Owner\Documents\Arduino & firefly files
export.application.stop=true
editor.divider.size.windows=2
last.sketch1.path=C:\Users\Owner\Documents\Arduino & firefly files\RTC_I2C_test\RTC_I2C_test.pde
preproc.enhanced_casting=true
run.display=1
last.sketch1.location=490,200,500,600,418
platform.auto_file_type_associations=true
editor.antialias=false
last.sketch3.location=331,18,777,718,536
preproc.save_build_files=false
last.screen.width=1280
export.application.platform.macosx=true
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

retrolefty

#7
Aug 20, 2011, 09:00 am Last Edit: Aug 20, 2011, 09:10 am by retrolefty Reason: 1
My sketches are stored here:


C:\Documents and Settings\Primary Windows User\My Documents\Arduino

In that folder there is also a folder named libraries:

Quote
C:\Documents and Settings\Primary Windows User\My Documents\Arduino\libraries

16 Folders:

Bounce
Button
DS1307
EasyTransfer
Flash
FreqCount
FreqMeasure
MsTimer2
NewSoftSerial
Playtune
SoftEasyTransfer
Streaming
String
Tone
WString
__MACOSX


0 Files:


Here is the contents of one of the library folders, note that the .h and .cpp files must have the same name as the library's folder name:

Quote
C:\Documents and Settings\Primary Windows User\My Documents\Arduino\libraries\MsTimer2

1 Folders:

examples


3 Files:

MsTimer2.cpp
MsTimer2.cpp.patch
MsTimer2.h


Now when I launch the Arduino IDE and get a blank sketch, if I select the sketch/import libary menu all the library file name will be there from both the Arduino core library folder  and the arduino user's sketch library folder (if such a folder exists, as again you have to create it). And if I scroll down and select MsTimer2, it then automaticly places the include statement into the blank sketch on the IDE, looks like

Quote
#include <MsTimer2.h>



So it doesn't matter what version IDE you are using (post version 12 I think) they will all know to look both places for libraries. Even if you have multiple versions installed on your PC, they will all know to also look in the users sketch folder for a libraries folder as well as to look for the arduino 'core' libraries. Nothing in the preferences.txt defines or enables this 'search for libraries folder inside users sketchbook folder, it seems to be 'hardwired' IDE behaviour.

That help any better. It's one of those things that would better be explained on a Utube video then trying to type out.  :(

Lefty

CrossRoads

"they will all know to also look in the users sketch folder for a libraries folder as well as to look for the arduino 'core' libraries."
Ok, that was the part I needed.
Thanks Lefty.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up