// 74HC 165 Q7 = 5 (Data)
// 74HC 165 PL = 4 (Latch)
// 74HC 165 CP = 2 (Clock)
// 74HC 165 CE = 3 (Clock Enable)
const int _srInData = 5;
const int _srInClock = 2;
const int _srInLatch = 4;
const int _srInClockEn = 3;
const int _srOutNumBits = 8;
const int _srInNumBits = 8;
int _WriteData[_srOutNumBits];
int _ReadData[_srInNumBits];
void setup() {
pinMode(_srInData, INPUT);
pinMode(_srInClock, OUTPUT);
pinMode(_srInClockEn, OUTPUT);
pinMode(_srInLatch, OUTPUT);
Serial.begin(9600);
Serial.println(F("Start..."));
}
void loop() {
digitalWrite(_srInLatch, LOW);
digitalWrite(_srInLatch, HIGH);
byte _dataIn;
digitalWrite(_srInClock, HIGH);
digitalWrite(_srInClockEn, LOW);
_dataIn = shiftIn(_srInData, _srInClock, MSBFIRST);
digitalWrite(_srInClockEn, HIGH);
Serial.print("Data of _dataIn: ");
Serial.println(_dataIn, BIN);
delay(200);
// digitalWrite(_srOutLatch, LOW);
// shiftOut(_srOutData, _srOutClock, MSBFIRST, ~_dataIn);
// digitalWrite(_srOutLatch, LOW);
// Serial.print("Data of _dataIn: ");
// Serial.println(~_dataIn, BIN);
}