Single button to scroll through sensor data on 16x2 LCD

Hi there,

I don't have code for what I want to do. I only need a few pointers/ideas.

I have a 16x2 LCD display which I want to use to display 8 x sensor data outputs (testbench) by using a single pushbutton to scroll/rollover through values. The top line data display is static. The bottom line has sensor values. Example;

16 x 2 LCD


Temp: 26.5 oC PID: ON

  1. t: 2 min q: 50 ml

So every time i press the pushbutton, the next sensor (1., 2., 3. etc) should display in the same format on line 2, i.e.


Temp: 26.5 oC PID: ON
2. t: 5 min q: 66 ml

etc etc. until the 8th sensor is displayed, then another buttonpush reverts to sensor 1. No need to exit, move up and down or enter a sub-menu.

My sketch works in terms of producing a timestamp and sensorvalue for each of the 8 sensors.

My thinking is to use a simple buttoncounter and switch case statement. Any ideas/examples on how this could be accomplished?

Thanks in advance.

The StateChangeDetection example that comes with the IDE might be of use; limit the buttonPushCounter variable to 8 (for 8 sensors).