And condition evaluation on a code

I am wondering if there is a known issue with any specific batch of Arduino pro mini 5V 328. None of the last three units that I buy are evaluating the and (&&) condition in a code. Even the simplest code to control pin 13 LED with the change of two diferent pins condition is failing on my units.

Blick code was already used to confirm the state of pin13

Here is the simplest code that it fails to evaluate (cause the LED never goes off)

void setup() {

// initialize the digital pin as an output.

// Pin 13 has an LED connected on most Arduino boards:

pinMode(13, OUTPUT);

pinMode(3,INPUT);

pinMode(2,INPUT);

}

void loop() {

if ((digitalRead(3)==HIGH)&&(digitalRead(2)==HIGH));

digitalWrite((13),HIGH);

if ((digitalRead(3)==LOW)&&(digitalRead(2)==HIGH)) ;

digitalWrite((13),LOW);

}

Please advice and thanks in advance.

You haven’t told us what doesn’t work. How do you have the inputs wired ? Are they connected to some switches ? How ? Do you have a problem similar to this ? I note you don’t have the internal pullups enabled.

https://forum.sparkfun.com/viewtopic.php?f=14&t=34692

FYI …

(click on to enlarge)

Since the IF statements are terminated by a semicolon, they don’t do anything.

The proper format is summarized by

if (test_condition_is_true) {
do_something;
}