Interaction between pins

For a home made escape room, I am trying to check if 3 sets of two pins are connected.
It works for the first two, but not the 3rd, and I don't understand why.

The basics: players have a 3x3 grid with end points. They have to connect 3 pairs together correctly in order to unlock something.
For this I have 3 emitter pins and 3 receiver pins. To avoid problem if players connect 2 emitters together I turn them on and off one at a time.
For some reason receiver3 is always LOW.

What am I doing wrong ?

Here is the code:

#define emitter1 10
#define emitter2 11
#define emitter3 12

#define receiver1 A0
#define receiver2 A1
#define receiver3 A2

#define diodeRed 3
#define diodeGreen 4

int val1;
int val2;
int val3;
void setup() {
  pinMode(emitter1, OUTPUT);
  pinMode(emitter2, OUTPUT);
  pinMode(emitter2, OUTPUT);
  pinMode(receiver1, INPUT);
  pinMode(receiver2, INPUT);
  pinMode(receiver3, INPUT);

  pinMode(diodeRed, OUTPUT);
  pinMode(diodeGreen, OUTPUT);

  // initial state
  digitalWrite(diodeRed, HIGH);
  digitalWrite(diodeGreen, LOW);

void loop() {

  // reads first pair
  digitalWrite(emitter1, HIGH);
  val1 = digitalRead(receiver1);
  digitalWrite(emitter1, LOW);
  // reads second pair
  digitalWrite(emitter2, HIGH);
  val2 = digitalRead(receiver2);
  digitalWrite(emitter2, LOW);
  // reads third pair
  digitalWrite(emitter3, HIGH);
  val3 = digitalRead(receiver3);
  digitalWrite(emitter3, LOW);
  Serial.print(", val2:");
  Serial.print(", val3:");

  // quantum diode set
  if (val1 == HIGH && val2 == HIGH && val3 == HIGH) {
    digitalWrite(diodeRed, LOW);
    digitalWrite(diodeGreen, HIGH);
  } else {
    digitalWrite(diodeRed, HIGH);
    digitalWrite(diodeGreen, LOW);


And here is the circuit diagram (attached):

Also here is a link to tinkercad:


could it be that you have this twice in your Setup rather than 'emitter3'?

 pinMode(emitter2, OUTPUT);


How did I miss that.
Thanks, that was it.


we've all done similar...

looking for something we tend to see what it should be rather than what it is.

Another pair of eyes, or walk away for a cup of coffee and come back later for a fresh look at it, usually makes it a bit easier to spot.