Is there an easier way to swap IDE from teensy to non-teensy?

ninja2

Well-known member
I have some sketches I use on teensy and other Arduinos. When I compile for teensy I get errors telling me there are multiple libraries conflicting between the teensy library, and the same library on SKETCHES/libraries. So I remove the offending library folder out of SKETCHES/libraries and I can compile OK.

But when i want to compile same sketch for a non-teensy board I have to reinstate the libraries into SKETCHES/libraries.

Is there an easier way to swap?
 
Could you use full path references to your (appropriate for each selected target Arduino/processor) libraries ??

Mark J Culross
KD5RXT
 
There is a way. Whether it's "easier", well, you can be the judge of that...

Each board (or "package" that serves all boards of the same type) has its own "libraries" folder. All you need to do is copy the library you want to that folder and then delete it from the sketchbook "libraries" folder, so Arduino IDE uses the copy from each package's folder.

Easy, right? Well, except those package-board specific "libraries" folders are deep within the Arduino15 folder where Boards Manager installs files, though the full pathnames are shown on any compile error or even during successful compiles if you've turned on verbose output during compilation in File > Prefs.

The main gotcha is when you update any board's package (eg, Teensyduino 1.58.2 -> 1.59.0) the Boards Manager deletes the old folder and all its contents which would include any libraries you've copied into its "libraries" folder. So you'll need to re-copy those libraries to the newly installed version when you do any updates.
 
OK got it, thanks, I've copied the relevant libraries into the AVR and Renesas packages:
Code:
C:\Users\...\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries
C:\Users\...\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.1.0\libraries
C:\Users\...\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\libraries
and its working ... so far.
 
Last edited:
The approach I've adopted is to have a different sketchbook location directory for each project.
These may contain a couple of related sketches for the same hardware (e.g. for one I have a bootloader and a main application) but are different for different projects.
I then check that entire directory in to source control rather than just the one for the sketch. That way I have an archive of not just the code but also the libraries and library versions used.

It means changing settings between projects and installing duplicates if two different projects use the same library. But it also allows better library version control and prevents issues with library name collisions between different board types.
 
Sounds interesting. How exactly do you "check that entire directory in to source control"?
 
Sounds interesting. How exactly do you "check that entire directory in to source control"?
Same way you would for anything else. Source control tools like git archive all the requested files / directories, they don't care what the files are. All you need to do is start the archive one directory higher up the tree.
 
Sounds like a Linux tool? I'm on Win 10
No. Windows has plenty of source control tools available, it would be impossible to do any meaningful development on windows if it didn't.
And every version of windows / MS-DOS ever released has had directores.
I suspect this is a terminology issue more than anything. Newer versions of windows likes to call directores folders instead, I'm not sure why they changed the name other than to confuse people. And source control/version control tools are simply a way to track changes to files, you can run them on anything.
 
Source control systems like git and supporting online service like github bring a lot of valuable features. But like most tech with valuable features, if you're not feeling the need for those features it usually just becomes a burden to learn and use something you didn't really want in the first place.
 
I'd agree that most source control tools involve a learning curve and hassle that simply isn't worth it for a lot of casual projects.
But source control is a bit like backups, it's unnecessary, annoying and not worth it until it's too late. And then you're screwed.

git is complete overkill for simple projects, I certainly wouldn't recommend it for most people. But I would recommend some form of basic code archiving. It could be as basic as zipping up the directory and naming it with the current date when you first get something working or before making any big changes. Something so that if you screw up a change you can get back to a version you know worked.
 
No. Windows has plenty of source control tools available, it would be impossible to do any meaningful development on windows if it didn't.
And every version of windows / MS-DOS ever released has had directores.
I suspect this is a terminology issue more than anything. Newer versions of windows likes to call directores folders instead, I'm not sure why they changed the name other than to confuse people. And source control/version control tools are simply a way to track changes to files, you can run them on anything.
Newer versions of Windows? Like maybe only the last 30 years :LOL: Maybe longer... I am guessing that a large percentage of users on Windows (and probably MAC) almost never have used a command line. So, things like Folders are a lot easier to visualize than directory...

Git/Github - Yes the CLI stuff can be very hard to understand. But there are now decent GUI implementations, which make it pretty easy to use for most things... The majority of the time now I use the github desktop app, which they keep improving. For example you now can do things like: squash multiple changes and the like. You might give it a try.
 
Newer versions of Windows? Like maybe only the last 30 years :LOL: Maybe longer...
Windows 95 would have been the first time they did that. I'm fairly certain windows 3.11 still used the dos term and called them directories. So the jokes on you, it's only been 29 years...
I remember telling someone to enter something on the command line and was met with "what's that" around 97. The internets been going downhill ever since then ;-)

Thanks for making me feel old.

But at least microsoft still cater for us old guys, you enter cmd in the location box in file explorer and it opens a command prompt in the current directory.
 
But at least microsoft still cater for us old guys, you enter cmd in the location box in file explorer and it opens a command prompt in the current directory.
Thanks a lot! Wish I would have known this feature long time ago...

Paul
 
Windows 95 would have been the first time they did that. I'm fairly certain windows 3.11 still used the dos term and called them directories. So the jokes on you, it's only been 29 years...
Yep - but I also played with the beta releases 😆
Thanks for making me feel old.
Believe me, I know the feeling!

But at least microsoft still cater for us old guys, you enter cmd in the location box in file explorer and it opens a command prompt in the current directory.
Actually mine is set up to use the Windows Terminal, which I like a lot better!
 
I used to teach MS-DOS to keen novices around 1990. After a couple of years it became clear half of every class would just never get it
... microsoft still cater for us old guys, you enter cmd in the location box in file explorer and it opens a command prompt in the current directory.
that's a neat trick! I actually still have a CMD shortcut on my desktop but TBH it hardly ever gets used. (old habits die hard).

Interesting perspectives on source control above (or what I knew as "Software Configuration Control"). My history is more hardware (and assembler code) than software but after maybe 15 years as an amateur playing with Arduino I've built up quite a repository of sketches etc. So I am at the point where I probably should transition to git or similar, but I'm not having enough hassles (yet) to justify the learning overhead. Although this swapping between teensy and non-teensy might become a trigger ..
 
Last edited:
Back
Top