Arduino IDE Questions

Hi all,

I'm fairly new to the Arduino IDE, and I have a few general questions. For the record, I am using it on OSX.

  1. Is the IDE itself customizable in terms of appearance? I like to code on a black background for instance. I know about the config file but couldn't find any appearance sections (though I might have missed them). I'm also considering using an external editor, I like the "integrated" part of an IDE though.

  2. Is there any way to get an "open windows" menu item? I tend to keep a lot of files open and switching between them isn't easy.

  3. Sometimes I find that I need to modify a library for a custom purpose. If I copy the library and modify it, then sometimes the compiler chooses the wrong library at compile time. What is the best recommended practice for dealing with this? I have tried a few things but haven't found a great solution yet.

Thank you!

Josh

  1. You can set the colors and fonts at {Arduino IDE installation folder}/lib/theme/theme.txt and {Arduino IDE installation folder}/lib/theme/syntax/default.xml

  2. You should always put your modified libraries in the {sketchbook location}/libraries folder. Make sure that the library folder name is the same as the include file name(for example, if you are adding the line #include <Ethernet.h> to your code to include the library then the folder name should be Ethernet). Make sure the architectures field in library.properties explicitly matches the architectures it is compatible with instead of using a wildcard. If you do those three things that library should always take include priority over any other library.

Hi there,

I apologize for the delay, for some reason I didn't get a notification you'd replied!

  1. Oh awesome. I am going to experiment with this a bit. I'm worried if I just flip colours indiscriminately I might accidentally end up with unreadable text. Luckily I can always go back to the original file and start again. Do you know if I need to exit the IDE before I try any of this?

  2. I'll have to look more into this. I am saving my altered libraries in my directory, not the installed one. I guess where I am running into issues conceptually is that if I modify a library to say, use different pins, I need to save that version and make sure that project always uses that version. Other projects may require different versions. I think what the ultimate solution is to either make local copies of the library that are explicitly included, or modify the libraries to take more config info from #defines or something similar that I set out for each project.

Thanks for the reply!

jkoffman:
Do you know if I need to exit the IDE before I try any of this?

I’m pretty sure you have to restart the IDE before the changes will take effect because the file is only read when the IDE is starting up. It shouldn’t make a difference whether you edit the file while the IDE is open, then restart or close the IDE, edit, then start.

jkoffman:
I think what the ultimate solution is to either make local copies of the library that are explicitly included

You can put the library folder inside of the sketch folder. Then you need to use the #include “foo/foo.h” syntax instead of #include <foo/foo.h>. If you’re using Arduino IDE 1.6.10 then you need to put the library folders inside of a src subfolder of the sketch folder and then do #include “src/foo/foo.h”. This change has been reverted because some people complained so when Arduino 1.6.11 comes out using the src subfolder will no longer be required.

jkoffman:
or modify the libraries to take more config info from #defines or something similar that I set out for each project.

Unfortunately that’s fairly difficult to do and the Arduino developers have specifically blocked any change that would make it easier because they think it would lead to more complex library APIs.

The solution I’ve settled on is to put all code that will rely on the sketch #defines in the library’s .h file. That file can see the #define if it’s done before the file is #included, the .cpp can’t. A few libraries consist solely of .h files so those would require the least modification but most have .cpp files. Of course it’s definitely not ideal to put code in the .h file so I avoid doing this whenever possible but sometimes you just need the preprocessor because there’s no way to do the configuration at run time.

If you want to modify platform.txt I believe you can change the behavior of the IDE to allow libraries to #include a configuration .h file from the sketch folder. The downside of this is you will need to make the change in every core that you want to use the library with and redo it whenever you update to a new core version/IDE version and it makes your code non-portable to any stock Arduino installation.

The other solution is to add a custom Tools menu in boards.txt to set #defines via compiler flags but this has all the disadvantages of the previous solution and is less flexible.