dm41nes:
// first test is for continuity and OUTPUT/HIGH
pinMode(pinsCableBegin[i], OUTPUT);
if (digitalRead(pinsCableEnd[i])!=HIGH)
Did you already try adding the delay here as I suggested at least twice already? An Arduino is much faster than even one optocoupler and you have two in series.