Editing the existing ".h" files

Is there any methods for us to edit the ".h" files instead of creating a new one by oneself?
Or even is there any methods for us to look into the ".h" files

It's on your PC, you can edit it all you want. Or... you can request changes/additions to the author so it gets may benefit everybody

A .h file is just a text file. You can open it with any text editor, read it, and edit it. I do recommend that you use a good quality text editor program suitable for use in programming rather than something like Windows Notepad.

I actually use the Arduino IDE to edit my Arduino libraries, though I don't bother to do that when I'm editing a library I didn't write and certainly not if I only want to read the file.

Yes

Use a decent editor (vi, notepad++ etc).

Now the question is what you want to achieve? Editing .h files is usually not what is needed; the actual code is in the .cpp (or .c) files that come with the library.

Notes:
1)
Be aware that changes made to a standard Arduino library or 3rd party library will affect all old projects (when you recompile them) and all future projects.
2)
Do not modify the standard Arduino libraries; changes will be lost after an update of the Arduino software / libraries.
3)
It's common to modify 3rd party libraries to e.g. solve interrupt conflicts; a number of libraries even cater for it.

1 Like

pert:
I actually use the Arduino IDE to edit my Arduino libraries,

How? My IDE refuses to open any .h file that's not already on a tab.

-jim lee

Here's how to use the Arduino IDE to edit a library:

  • Add a dummy .ino file to the folder containing the library files you want to edit with the Arduino IDE. The .ino filename must match the folder name.
    This allows the Arduino IDE to open the library source files as if they were a sketch.
    This file will not actually be compiled as part of the library. I use it as a place to store my "to do" list. You could also use it for a test sketch for the library, in this way you can actually compile the library right from the same IDE window where you are editing it instead of having a sketch open in a separate IDE window.
  • Add a file named .development to the root of the library folder.
    This is necessary because otherwise the Arduino IDE treats the contents of the library as read-only (to prevent people from accidentally modifying example sketches).
  • If it doesn't have one already, add a file named library.properties in the root of the library folder. You can find the specification of the format here: Redirecting.
    This is required for the .development feature to work. The exact contents of the library.properties file is not important as long as it meets the specification. You could even just copy one from another library if you like, though I would recommend changing the name value so as to avoid confusion.
3 Likes

Thanks, but I think that I will stick to using Notepad++

1 Like

Ewww. That sounds great! I'm going to give that a try, thanks!

-jim lee