The yellow part is the second Serial.print(pin5);
How do you know this?
Serial.print("pin5 value: [");
Serial.print(pin5);
Serial.println("]");
would convince me.
What happends with 0 position? I tried sending 2 values (for both sensors) and I have to use 2 and 4 positions to read both... What happends with other 2 positions?
Without seeing all of your code, for both ends, I wouldn't even care to guess.