Notifications
Clear all

Understanding IDE Libraries

43 Posts
4 Users
10 Likes
2,468 Views
(@peterpoggi)
Member
Joined: 2 years ago
Posts: 24
Topic starter  

Hi Everyone, I'm obviously very new to Arduino. I've built the Elegoo Robot Car V4, I've purchased run some experiments with  the ELEGOO Mega2560 Starter Kit, and I've also done a few of the experiments here.  I've erased and reloaded the IDE several times and I think I may have created a mess with my libraries.  From what I can tell, I see two individual libraries, containing some, but not all, overlapping files....

C:\Program Files (x86)\Arduino\libraries

and C:\Users\Peter\Documents\Arduino\libraries

Can anyone explain the difference between these, and whether there should even BE two libraries?  

I just found the following additional info on the arduino.cc site...

Please note: Arduino libraries are managed in three different places: inside the IDE installation folder, inside the core folder and in the libraries folder inside your sketchbook. The way libraries are chosen during compilation is designed to allow the update of libraries present in the distribution. This means that placing a library in the "libraries" folder in your sketchbook overrides the other libraries versions.

So what do they mean by a CORE FOLDER?    I wish I could find a graphic of this...

This topic was modified 2 years ago 2 times by PeterPoggi

   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 
Posted by: @peterpoggi

Hi Everyone, I'm obviously very new to Arduino. I've built the Elegoo Robot Car V4, I've purchased run some experiments with  the ELEGOO Mega2560 Starter Kit, and I've also done a few of the experiments here.  I've erased and reloaded the IDE several times and I think I may have created a mess with my libraries.  From what I can tell, I see two individual libraries, containing some, but not all, overlapping files....

C:\Program Files (x86)\Arduino\libraries

and C:\Users\Peter\Documents\Arduino\libraries

Can anyone explain the difference between these, and whether there should even BE two libraries?  

I just found the following additional info on the arduino.cc site...

Please note: Arduino libraries are managed in three different places: inside the IDE installation folder, inside the core folder and in the libraries folder inside your sketchbook. The way libraries are chosen during compilation is designed to allow the update of libraries present in the distribution. This means that placing a library in the "libraries" folder in your sketchbook overrides the other libraries versions.

So what do they mean by a CORE FOLDER?    I wish I could find a graphic of this...

The ONLY Library Folder or Directory you need concern yourself with is the (user)\Documents\Arduino\libraries. But even that folder is not for you to mess with other than through one of two IDE menus. For the core libraries, "Tools>Manage Libraries..." and for 3rd party "Sketch>Include Library..." the later is often used after downloading a zip file from github. The word Library has 2 meanings unfortunatly, one as a resource for building sketches/programs and the other is runtime code used by different pieces of software. Some system libraries are stored under a parent with the name of the software as in Program Files\Arduino\Library and some are HUGE collections for the system.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

Here are the two (the 3rd is builtin) Library directories on a Mac, Windows is similar with only the names that are different for system stuff being different. In either case you do not manipulate either of these folder contents directly, only the IDE menu interface is used. I documented that earlier. The first taken at 15:03:25 is of the system maintained Arduino Library, the second taken at 15:04:08 is of the user maintained Arduino Library. This library is maintained via the IDE Manage Library menu item and the Include Library menu item for github zip files.

Screen Shot 2022 02 05 at 15.03.25
Screen Shot 2022 02 05 at 15.04.08

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@peterpoggi)
Member
Joined: 2 years ago
Posts: 24
Topic starter  

Thank you Ron, 

This is very helpful. I'm going to re-install, once again - from scratch, and then reattempt to run the Elegoo keypad lesson.  From what I read, I need to install the "Keypad" library. I think this is provided in the Elegoo Mega2560 kit files..  Which method is the best / where should that library be installed? with the program files, or with the library in the user documents? 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

@peterpoggi Let me answer in reverse order. You don't directly install or select where to install a library, It's automatic. Using the Arduino Library Manager here is part of what I get.

Screen Shot 2022 02 05 at 16.46.45

What you need to do is select the appropriate library as documented in the Elegoo docs. Either it's one of those available in the Library Manager or they will give you a github link which means using the 2nd install method. If you don't see the answer, send me a copy of the documentation file or a link so I can read it. Send it to me in a private message. When I search on Elegoo I get nothing so it is likely an existing Keypad library like Adafruit. Can you send me a link to where you purchased the kit? 

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@peterpoggi)
Member
Joined: 2 years ago
Posts: 24
Topic starter  

Ok, I've started out with a clean install - this time, I didn't "install". I copied the unzipped files into my Programs(x86) directory, and set it up as portable.   I'm already ahead of where I was before, because I was able to store my edited variation of blink, as "myblink" without file access errors!  🙂  

Now i've opened up the keypad (membrane switch) code, compiled it, and as I expected, it didn't find the library. I do have the keypad.zip file separate but I have not yet attempted to install it. I will send you both the code and the library in a PM.  Thanks again!!


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

@peterpoggi STOP!!!!!!!!!!!!!!!!!

YOU NEVER TOUCH THE CONTENTS OF PROGRAM FILES !!!!!!!!!!

I have explained the process here and on 2 other threads at least several times. Do you have a problem with reading?

If the library is in github click on the download zip file. Then from the arduino IDE Sketch>Include Library>Add Zip Library.

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@peterpoggi)
Member
Joined: 2 years ago
Posts: 24
Topic starter  

@ronalex4203 

No, I actually read quite well - I think that there is a communication issue here, as I do not believe what I have done is alter the contents of any original program files. Anything I alter, such as the LED blink rate in the sample BLINK program is saved as a separate sketch using a new name.   If that IS the "touching" you mean, then I stand corrected, however making changes to a program to see the effects of that change is the way I learned Cobol, PL/I, Pascal, FORTRAN, CICS, and Visual Basic.  Maybe we just did it different in my company. 

 

Anyway, I was able to install the keypad library in this new install, I connected the keypad, compiled it and it ran.   

thank you for your help.  Have a great evening


   
Ron reacted
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 

"I copied the unzipped files into my Programs(x86) directory, and set it up as portable."

Can you explain this step? I have never manually copied anything related to the Arduino IDE into to the program folder, so I'm confused what you're doing.

This post was modified 2 years ago by YurkshireLad

   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

@yurkshirelad That is not how you add a library, that Library folder is to run the Arduino IDE, the libraries for your sketches are under (user)>Documents>Arduino. There will be a bunch of sketch folders there as you create them and one libraries folder that the ide will store the c code and headers to be included in your sketches.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 
Posted by: @ronalex4203

@yurkshirelad That is not how you add a library, that Library folder is to run the Arduino IDE, the libraries for your sketches are under (user)>Documents>Arduino. There will be a bunch of sketch folders there as you create them and one libraries folder that the ide will store the c code and headers to be included in your sketches.

I know. I'm trying to understand what he's doing.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

@yurkshirelad I strongly suspect him and another thread are manually moving files around instead of using the arduino IDE. I just found the official documentation, maybe they will believe that.

https://www.arduino.cc/reference/en/libraries/

Folow the link to Installing Libraries.

 

NOTE the error re Importing Libraries should be Include Library

Also note the comment how when installing a new arduino release the entire dir is erased, so any libraries you installed there (NOT according to directions) will be wiped out.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@peterpoggi)
Member
Joined: 2 years ago
Posts: 24
Topic starter  
Posted by: @yurkshirelad
Posted by: @ronalex4203

@yurkshirelad That is not how you add a library, that Library folder is to run the Arduino IDE, the libraries for your sketches are under (user)>Documents>Arduino. There will be a bunch of sketch folders there as you create them and one libraries folder that the ide will store the c code and headers to be included in your sketches.

I know. I'm trying to understand what he's doing.

Hi Yurkshirelad, 

While Ronalex can use a little work on his advice delivery, he is  correct.  You shouldn't do what I'm doing 🙂    I decided to proceed with what some call a "Portable" installation. You can research portable Arduino installs. What I'm doing is not a traditional install.

https://www.arduino.cc/en/Guide/PortableIDE

The reason I took this approach is that I did (and still don't) completely understand how the traditionally installed Arduino locates and "prioritizes" their code libraries. I was trying to add libraries, and getting error messages that they were already there, but yet I couldn't find them.  I  just wanted to understand a bit more of what was going on beneath the covers. The only advantage I see of a portable install is that everything is in one location, and you can move the entire environment off to a flash drive and to another computer. 

If you have any other questions or comments regarding the portable installation please feel free to send me a private message. In the meantime, follow Ronalex4203 advice and use a traditional installation. 


   
Inst-Tech reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6895
 

@peterpoggi My apologies for previous language used.

I found the official documentation that may answer your questions re library priority.

https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries

Be aware of one thing as noted in the docs, when you upgrade the arduino release, it wipes out the entire dir so any libraries installed in that (allowable) directory need to be re-installed.

As I have said many times ONLY install via the IDE and you will be fine.

BTW, I can also move my environment via a flash drive. (user)>Documents>Source Code. And of course the two arduino IDE's would have to be set up the same but that is no inconvenience.

Glad to hear you are happy.

p.s. I would be happy to show you where on my Mac ALL the libraries are via some screen prints but if you are happy with what you have then no need.

Here is a key comment in the arduino.cc web site

Screen Shot 2022 02 06 at 11.44.28

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@peterpoggi)
Member
Joined: 2 years ago
Posts: 24
Topic starter  

@ronalex4203 No worries, I know I can sound a bit obtuse at times.   Thank you for that link - reading it now. I like understanding what's going on under the covers and how the parts move. I don't have any production projects, and nothing I'm doing right now is important so I'm ok with deleting and reinstalling.  Just trying to learn how it all works. This is all good information. The screen prints would definitely be helpful.  Thanks again!


   
Inst-Tech reacted
ReplyQuote
Page 1 / 3