const int dataPin = 27;   /* Q7 */
const int dataPin2 = 27;
const int clockPin = 33;  /* CP */
const int latchPin = 25;  /* PL */
// const int clk1= 5;
// const int clk2= 6;
const int numBits = 8;   /* Set to 8 * number of shift registers */

void setup() {
  Serial.begin(115200);
  pinMode(dataPin, INPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(latchPin, OUTPUT);
  // pinMode(clk1, OUTPUT);
  // pinMode(clk2, OUTPUT);
  digitalWrite(latchPin, HIGH);
// digitalWrite(clk1,HIGH);
// digitalWrite(clk2,HIGH);
}

void loop() {
  // Step 1: Sample
  digitalWrite(latchPin, LOW);
  delayMicroseconds(10);
  digitalWrite(latchPin, HIGH);

  // digitalWrite(clk1,HIGH);
  // digitalWrite(clk1,LOW);
  // Step 2: Shift
  Serial.print("Bits: ");
  for (int i = 0; i < numBits; i++) {
    int bit = analogRead(dataPin);
    // if (bit == HIGH) {
    //   Serial.print("1");
    // } else {
    //   Serial.print("0");
    // }
    Serial.print(bit);
    Serial.print(", ");
    digitalWrite(clockPin, HIGH); // Shift out the next bit
    digitalWrite(clockPin, LOW);
    
  }
  // digitalWrite(clk1,HIGH);
  delay (100);
  //   digitalWrite(clk2,HIGH);
  // digitalWrite(clk2,LOW);
  // Step 2: Shift
  // Serial.print("Bits: ");
  for (int i = 0; i < 8; i++) {
    int bit = analogRead(dataPin2);
    // if (bit == HIGH) {
    //   Serial.print("1");
    // } else {
    //   Serial.print("0");
    // }
    Serial.print(bit);
    Serial.print(", ");
    digitalWrite(clockPin, HIGH); // Shift out the next bit
    digitalWrite(clockPin, LOW);
    
  }
  // digitalWrite(clk2,HIGH);
  Serial.println();
  delay(1000);
}
74HC165
74HC165