Create Function library

Hello,

I have read it's possible to create a library for function (not for method with C++)
Like the function : DigitalWrite for example. this function is create on "wiring_digital.c"
How can I create my library for function ? I have to create an .c and a .h file ?
On Google I have found only explication for library with method on C++ with object etc..

Finally I want to call the function in my main program, for simplify the programmation

Thank you for your help :wink:

Perhaps Google arduino create library

...R

The only tricky thing is that Arduino sketches are C++, not C. So to use C code from C++ you need to wrap it in extern "C" {}

Here's the first example I found of a C library for Arduino:

It's not the best minimal example.

Note how in the .h file they add this before the start of the C declarations:

#ifdef __cplusplus
extern "C" {
#endif

and this after:

#ifdef __cplusplus
}
#endif

That's really all there is to it.