74HC165 shift-in daisy chain question...

I have NO IDEA, how to do tha..

Some hints:

#define NR_OF_SHIFTREGS
uint8_t bit_readings[NR_OF_SHIFTREGS]; // storage for the bit values

void set_bit_reading(uint8_t pos, bool value) {
  // writes a single bit into our storage
  uint8_t index = pos / 8;
  if (index >= NR_OF_SHIFTREGS) return;
  bitWrite(bit_readings[index], pos % 8, value);
}

bool get_bit_reading(uint8_t pos) {
  // reads a single bit from our storage
  uint8_t index = pos / 8;
  if (index >= NR_OF_SHIFTREGS) return false;
  return bitRead(bit_readings[index], pos % 8);
}