Hi
I am using a DO-WHILE loop in my code to wait for either of 2 buttons to be pressed. To prompt the user to press either button, a blinking LED is placed beside each button.
Here is my code:
do // Wait until the Refresh or Exit button is pressed.
** {**
** digitalWrite(RefreshLED, HIGH); // Blink both LEDs to draw attention to**
** digitalWrite(ExitLED, LOW); // press either Refresh or Exit button.**
** delay(500);**
** RefreshVal = digitalRead(RefreshButton);**
** ExitVal = digitalRead(ExitButton);**
** digitalWrite(RefreshLED, LOW); // Blink both LEDs to draw attention to**
** digitalWrite(ExitLED, HIGH); // press either Refresh or Exit button.**
** delay(500);**
** }**
** while ((RefreshVal == LOW) && (ExitVal == LOW));**
** digitalWrite(RefreshLED, LOW); // Turn off both LEDs when either**
** digitalWrite(ExitLED, LOW); // Refresh or Exit button is pressed.**
I am testing my code on Proteus 8.0,
the LEDs would blink for a short time and
then exit the DO-WHILE loop and
switch off both LEDs; even none of the switch is pressed!
Is that a problem with Proteus or with my code?
