Yes you can. My question for you: are the A-E going to dynamically change as you switch screens or are they static once you start displaying them.
If they are static, use my phi_prompt library's scrollable long message and do something like:
simple_long_msg("A B \nC D \nE");
This will display all 5 things in a scrollable long message with a scroll bar on the right. Using up and down buttons you can scroll through them and press enter to dismiss the long message. Let me know if that is what you want. As I said, this can't handle dynamic updates as you scroll so A-E have to be determined by the time you call the function. Yes, the long message recognizes new line.
Joy:
And please help me removing that delay for the button debounce... as it will effct the other loops...
You don't need a 500 millisecond delay. Most switches are "done" bouncing within 50 to 100ms.
You can debounce a switch with a small capacitor, but you don't say how the circuit is built, so I won't recommend a value. Changing that delay(500) to delay(50) should work. Just remember that if you do that, you have to let go of the switch REALLY FAST or else the program will rapidly scroll through all of the screens
ok i removed the delay and used a similar program like the one used in the example of "Blink without delay"
But I have kept the debounce rate 250..
But I dont want the thing that when the button is kept pressed the screens will scroll over..
I want it like if the display is showing screen 1, pressing the button shifts display to screen 2 but until and unless the button is released and pressed again there will be no change in the scree...
Joy:
All values A, B, C, D, E are continuously calculated by arduino and so they will change dynamically...
That was what I feared. Then my code won't help you. To make the buttons work the way you describe, you should record the button state in a variable and compare its value with reading to capture NOT the button in the down state, BUT capture the button changing from up to down TRANSITION.
int prevState = HIGH;
int currState;
void loop()
{
currState = digitalRead(somePin);
if(currState != prevState)
{
// A transition occurred (assuming that HIGH is not pressed and LOW is pressed).
}
prevState = currState;
}
And how are you connecting the button on the breadboard? Makes a big difference between connecting it the right way and the wrong way. Need diagram or description.
Its isnt that the code is not working with the button...
What is happening is that when I press the button once from Case 1 it changes to Case 2 then when I release the button again it changes from Case 2 to Case 3
currstate = digitalRead(switchPin);
if (currstate != prevstate){
Your code responds to a transition in either direction, LOW -> HIGH and HIGH -> LOW, so reacts when you press the switch and when you release it. You only want to respond one or the other. So, try something like this:
Thanks for the tip, I'm perhaps a newbie, but I know what clear (), is, I've tried it in slightly different locations in the code, without quite get it to work.