How can I include examples in library? I have written a library for Arduino, my_library, consisting of my_library.h and my_library.cpp, both included in my_library folder. Actually the library is recognized from IDE Arduino and works fine.

I want to add some examples, let's say Example1 and Example2. How is that possible?

Should the examples be included in my_library folder?

or should be included in another folder inside my_library folder?

I tried several combinations but none worked. Do I miss something?
You need to create a folder called "examples" in your library folder. Within there, each in its own folder, you place your examples.

For example:

MyLib/
MyLib/MyLib.h
MyLib/MyLib.cpp
MyLib/examples/
MyLib/examples/Example1/
MyLib/examples/Example1/Example1.ino
MyLib/examples/Example2/
MyLib/examples/Example2/Example2.ino


Be sure to name the example's folder the same as the name of the example.