I have some function with headers (a.h and b.h for exemple) located on the arduino default library folder.
So when I create a new sketch, I add to include those header on the top of the sketch **#include <a.h> and #include <b.h>** to be able to use them.
To avoid #including all personnal header each time we create a new sketch, is there a way to modify arduino files so files are included automatically ?
For example add the headers in the arduino main.cpp file ?
If I was reading your code, soon enough I'd see things to wonder about. The first look back would be up top to see what you included… hmmm, nothing included, where is DOG_WEIGHT defined?
Thanks ! A very good idea, mixed with @gfvalvo idea.
I found the step for IDE > 2 here how to setup default new sketch folder
(I've just discovered that the IDE has is own command palette ^^)
But #include still appears on new sketch.
So, I maintain my first question, if someone have an idea ^^
I wish I can't see any #include on the top of new sketches
In the same way, you don't care about seeing #include "digital.h" or #include "analog.h", I want that, if I always use a custom function, it's already automatically included into my sketches.
You would add #include directives for the header files to the Arduino.h file in the cores of the boards you are working with. The Arduino sketch preprocessor automatically adds an #include directive for Arduino.h to the top of the sketch before compiling.
If you enable verbose compilation output in the Arduino IDE preferences and then compile a sketch, you will see the base location of the core in the black Output panel at the bottom of the Arduino IDE window. For example, if the output looks like this:
Using core 'arduino' from platform in folder: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
If looking for it with your file manager or command line, note that the AppData folder is hidden by default. On Windows "File Explorer", you can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".
But I agree with others that it is a bad idea. You would have to redo this after every time you update a boards platform and it means your sketches will only compile in your modified environment so you can't easily share them with others.
There is a big misunderstanding here... what is the problem if don't want to see my #include function on top of my sketches ?
It's a bit weird to think bad about a simple question which is about how I want to organize my sketches... very weird reaction here...
I don't have the right to organize my sketches like I want ? strange...
I do understand that It can make bug so, thanks to your responses, I have the second option if it's the case.
So I'll appreciate if someone can help me reach the initial question, without jugging
Programming has conversations. These exist because in real world programming, you are not likely to be the only person on the only computer working on your program, and if you are, you are not likely to be the person to maintain it. Straying from these conventions will always draw judgement, and if you plan on willfully straying, it's something that you'll need to get used to.
You can all but write off future help debugging programs here, if you have hidden includes.
please, @van_der_decken and @er_name_not_found
if you don't want to help, please don't waste you time, please let others openminded answer if they want
So, to go in the right way, let me explain one exemple :
I usually need tu Serial.print variables to debug, so I make a function to be able to use for exemple monitor("var1name",var1name, "var2name",var2name,...) with some code inside to make tabulation and other stuff I need for a good printing.
I got many functions like that and each time I create a sketch, I have to #include all, and with all global variables and others stuff, I don't like seeing a lot of coding before the setup(), that's why I'm often looking for a way to make lighter my coding.
So it will be helpull for me If the #include of a specific folder (where I put my often used function) is automatic.
I don't want to modify minima core folder, just if possible adding a #include of my folder somewhere, so Even If I update my ide, I just have to re-write this #include and thats all.
Again, I know now thanks to @er_name_not_found and @gfvalvo that there is one way to have minimum #include, but I'll be more satisfy if I find a way to my first question.