Pushbutton and images

Hi there :),

I want to use a push button to select a image one at a time, when he is pressed! But instead shows all one at a time.

void loop() { val=digitalRead(A5);

if (val == HIGH){ myGLCD.clrScr(); myGLCD.drawBitmap(0,0,80,60,bird,6);

} if (val == HIGH){ myGLCD.clrScr(); myGLCD.drawBitmap(0,0,80,60,cat,6);

} if (val == HIGH){ myGLCD.clrScr(); myGLCD.drawBitmap(0,0,80,60,dog,6);


I have one more question, when i put the image in full screen she gets blurred, can anyone help me? Thanks :)

If val is HIGH to get into the first if and display the first image, it will still be HIGH to get into the second and third. Instead of just checking for a HIGH, have a look at the State Change example that comes with the IDE and implement a counter to count how many times the button has been pressed. Make your decision to show a image based on the number of times the button has been pressed instead of simply the fact that it has been.

But instead shows all one at a time.

Not really surprising as that is what your code tells the Arduino to do.

Suggestions : Look at the StateChangeDetection example in the IDE. It will show you how to detect when a button [u]becomes[/u] pressed as opposed to when it [u]is[/u] pressed. Count the number of presses and display the image for the value of the counter.