I understand the concept but actually writing it is throwing me for a loop.
First decide what the library should do. I know that you have some code that you wish to turn into a library but which functions do you want to put into the library ?
Many Arduino libraries are written as classes which allows you to create multiple objects of the same kind with each instance being separate. An example of this would be the Servo library, which you may have used.
However, libraries do not need to involve classes if all you want to do is to have a bunch of utility functions that you can call into your programs using the #include command.
A library typically consists of two files with the same name but different extensions. The .h file contains function prototypes and variable declarations and the corresponding .cpp file contains the actual functions.
At its simplest it could be something like this
Main sketch
#include "someFunctions.h"
void setup()
{
Serial.begin(115200);
printMessage("Hello");
printMessage("World");
}
void loop()
{
}
someFunctions.h
#include <Arduino.h>
void printMessage(char *);
someFunctions.cpp
#include "someFunctions.h"
void printMessage(char * theMessage)
{
Serial.println(theMessage);
}
Put all three in the same folder which is easiest done by adding tabs to the IDE and giving them appropriate names which will create the files