Hi,
I'm trying to use 2x 74HC165 shift registers daisy chained.
My problem is that when I read the content of the register, I'm not able to read the D7 input.
I have the same problem if I only use 1 74HC165 but in this case, I've found out that if I connect the push button to pin 10 (DS) I can read it from there.
Here's my code:
void loop() {
digitalWrite(clockPin165, LOW) ;
delayMicroseconds(5);
digitalWrite(clockPin165, HIGH) ;
delayMicroseconds(5);
digitalWrite(CEPin165, LOW);
digitalWrite(clockInput165, HIGH);
loQueMeLlega = shiftIn(dataPin165, clockInput165, MSBFIRST); // Save first byte.
loQueMeLlega2 = shiftIn(dataPin165, clockInput165, MSBFIRST); // Save second byte.
digitalWrite(CEPin165, HIGH); // Ready for another loop.
Serial.println("Value Byte 1: ");
Serial.print(loQueMeLlega, BIN);
Serial.println("Value Byte 2: ");
Serial.print(loQueMeLlega2, BIN);
delay(500);
}
Does anybody know how can I read the content of the inputs D7 of each Shift register?
Moderator edit: </mark> <mark>[code]</mark> <mark>
// ********* ADD THIS LINE:
digitalWrite(clockInput165, HIGH); // This line should be here, before setting CEPin165 to LOW status.
digitalWrite(CEPin165, LOW);
// ********* REMOVE THIS LINE:
// digitalWrite(clockInput165, HIGH); // THIS LINE SHOULD BE REMOVED AND WRITTEN BEFORE SETTING CEPin165 TO LOW POSITION.
loQueMeLlega = shiftIn(dataPin165, clockInput165, MSBFIRST); // Save first byte.
loQueMeLlega2 = shiftIn(dataPin165, clockInput165, MSBFIRST); // Save second byte.
digitalWrite(CEPin165, HIGH); // Ready for another loop.