Screen selection with pushbutton??

Hi, I am working on a project to make a video receiver with an oled display. It will be displaying channel information for the selected video channel. I have the oled working and also have all of the pages for the 32 channels written in my code. I want to set up a pushbutton switch to move between the four channel groups, as well as the eight channels in each group. I was thinking of having a long press change the channel group, and a short press change the channel. I was wondering if there is some easier way to do this besides writing and re-writing the code with every page.

The code I have now is just displaying all of the channel screens in order, but I want to be able to change between them with the button.

Thanks for any help, I am a total newb!

Beta1.ino (11.4 KB)

I was wondering if there is some easier way to do this besides writing and re-writing the code with every page.

All of your functions at the top of the code do the same thing, with the exception of the text that they display. You need ONE function that takes 3 arguments.

If that data was in three arrays, or an array of structs, loop() would be orders of magnitude easier.

I think that if you do that, then it will become obvious that you can go from one page to the next or previous page simply by incrementing or decrementing an array index.

That should make your project rather trivial.

Thank you very much, Paul. I will look into it asap!