NOTE* I had to do an edit of the code I have here in the attachment because I had a lcd.clear(); statement in the wrong place and I also improved the AutoReturn. It should be good now…
Here is some code that I wrote to share with others in the community that can make it easy to organize and view instruction prints to an LCD. To get a better perspective on how these instructions work it would be best to take the time and breadboard this project. I say instruction prints because these instruction prints can replace written documentation or even a small manual (on a mega) to describe how to (program) i.e. use push buttons to set up the different variables in a complex program that interfaces with multiple sensors, user defined alarms set points and/or for whatever else you want to explain to the end user. Whatever program your writing it’s always good to have comments about what’s happening in the program. Most programs I write don’t need instructions but for some programs they can be extremely useful for explaining to the operator what’s going on and how to get it set up.
You could also do an overview of how the program functions that’ll be locked into your project and can’t ever be lost. Some electronic devices are rendered almost useless if you lose the manual but that can never happen if they are programmed into the device. The code I put together here is good for organizing those instructions into topics that allows the user to fast forward and rewind to read just the different topic headers without having to read or display all the instruction prints in each individual topic to get to the next topic header to find what you want. The code is actually pretty simple and isn’t doing anything that’s not real easy to understand. It uses just 4 push buttons, a 4 X 20 character LCD and 5 variables to work.
The bottom line of my I2C 4 X 20 character LCD is used in this program to flash 2 prints one after the other & just keeps alternating them. It alternates “Pres Push Button #1” and “To View Instructions” to remind the user how to access the instructions. The other 3 lines of the LCD can be used to display variables like temperature, voltage, light levels or whatever. This is just how I’m setting the program up for a friends electronic project that I’m building but you can do whatever you want in the main screen of the void loop. As long as the user knows to press push button #1 to get into the instructions. You could also have it printed on the face of the project box just below or above the LCD and save that space on the 4th line of the LCD for displaying something else.
The code is included in an attachment here. I haven’t found any bugs in it yet but there could be some. Anyway, try it and if you like it let me know what you think…
Good Luck With It
instructions.txt (35.9 KB)