// 74hc165
// D0…D7	Parallel input
// PL	    Parallel load (active low)
// CP	    Serial clock
// CE	    Clock enable (active low)
// Q7	    Serial output
// Q7_N	    Inverted serial output (usually not used)
// DS	    Serial input*
// GND	    Ground
// VCC	    Supply voltage

const int inverted_serial_output = 27; // Q7i data
const int parallel_load = 25;          // PL
const int serial_clock = 33;           // CP clock

void setup()
{
    Serial.begin(115200);
    Serial.println(F("Start..."));

    pinMode(inverted_serial_output, INPUT);
    pinMode(serial_clock, OUTPUT);
    pinMode(parallel_load, OUTPUT);
}

void loop()
{
    digitalWrite(parallel_load, LOW);
    digitalWrite(parallel_load, HIGH);

    byte _dataIn;

    digitalWrite(serial_clock, HIGH);

    _dataIn = shiftIn(inverted_serial_output, serial_clock, MSBFIRST);

    Serial.print("Data of _dataIn: ");
    Serial.println(_dataIn, BIN);

    delay(200);

    Serial.print("Data of _dataIn: ");
    Serial.println(~_dataIn, BIN);
}
74HC165