How to create an Arduino Library (see YouTube video #71 here: https://youtube.com/c/RalphBacon)
Here you will find the files used in the demonstration video above.
The video goes through all steps that the beginner will need when creating an Arduino Library. It's a painless, easy to do exercise that will free up your sketch for the more pertinent areas of code as you move mature code into the library.
Sample demo library code in GitHub
Remember to put the library files (.cpp, .h and keywords.txt) into a folder called "TestLibrary" in the libraries folder in your Arduino sketch folder. Then put the sketch file (.ino) in a folder in your normal Arduino sketch folder. (This is how they are already organised in the GitHub repository/zip file)
Just click the download button on this GitHub page to get a zipped file of the above.
Links to useful sites:
All about Arduino IDE keywords https://spencer.bliven.us/index.php/2012/01/18/arduino-ide-keywords/
The Arduino Library specification https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification