/*
74HC165 Shift register input example
(C) 2025, Kshyhoo
*/
const int dataPin = 2; // Q7
const int clockPin = 3; // CP
const int latchPin = 4; // PL
void setup() {
Serial.begin(9600);
pinMode(dataPin, INPUT);
pinMode(clockPin, OUTPUT);
pinMode(latchPin, OUTPUT);
}
void loop() {
Serial.print("Q before CLK: ");
for (int i = 0; i < 8; i++) {
Serial.print(digitalRead(dataPin)); Serial.print(" ");
}
Serial.println();
digitalWrite(latchPin, LOW);
delayMicroseconds(5);
digitalWrite(latchPin, HIGH);
delayMicroseconds(5);
Serial.print("Q after CLK: ");
for (int i = 0; i < 8; i++) {
Serial.print(digitalRead(dataPin)); Serial.print(" ");
digitalWrite(clockPin, HIGH);
delayMicroseconds(5);
digitalWrite(clockPin, LOW);
delayMicroseconds(5);
}
Serial.println();
Serial.print("CLK: ");
Serial.print(digitalRead(clockPin));
Serial.print(" LATCH: ");
Serial.print(digitalRead(latchPin));
Serial.println();
delay(1000);
}
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:GND.2
uno:RESET.2
uno:0
uno:1
uno:13
uno:3.3V
uno:AREF
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
uno:A6
uno:A7
uno:5V
uno:RESET
uno:GND.1
uno:VIN
uno:12.2
uno:5V.2
uno:13.2
uno:11.2
uno:RESET.3
uno:GND.3
sw8:1
sw8:2
sw8:3
sw7:1
sw7:2
sw7:3
sw6:1
sw6:2
sw6:3
sw5:1
sw5:2
sw5:3
sw4:1
sw4:2
sw4:3
sw3:1
sw3:2
sw3:3
sw2:1
sw2:2
sw2:3
sw1:1
sw1:2
sw1:3
flop1:D
flop1:CLK
flop1:S
flop1:R
flop1:Q
flop1:NOTQ
flop2:D
flop2:CLK
flop2:S
flop2:R
flop2:Q
flop2:NOTQ
flop3:D
flop3:CLK
flop3:S
flop3:R
flop3:Q
flop3:NOTQ
flop4:D
flop4:CLK
flop4:S
flop4:R
flop4:Q
flop4:NOTQ
flop5:D
flop5:CLK
flop5:S
flop5:R
flop5:Q
flop5:NOTQ
flop6:D
flop6:CLK
flop6:S
flop6:R
flop6:Q
flop6:NOTQ
flop7:D
flop7:CLK
flop7:S
flop7:R
flop7:Q
flop7:NOTQ
flop8:D
flop8:CLK
flop8:S
flop8:R
flop8:Q
flop8:NOTQ
or1:A
or1:B
or1:OUT
nand1:A
nand1:B
nand1:OUT
nand2:A
nand2:B
nand2:OUT
nand3:A
nand3:B
nand3:OUT
nand4:A
nand4:B
nand4:OUT
nand5:A
nand5:B
nand5:OUT
nand6:A
nand6:B
nand6:OUT
nand7:A
nand7:B
nand7:OUT
nand8:A
nand8:B
nand8:OUT
nand9:A
nand9:B
nand9:OUT
nand10:A
nand10:B
nand10:OUT
nand11:A
nand11:B
nand11:OUT
nand12:A
nand12:B
nand12:OUT
nand13:A
nand13:B
nand13:OUT
nand14:A
nand14:B
nand14:OUT
nand15:A
nand15:B
nand15:OUT
nand16:A
nand16:B
nand16:OUT
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
led4:A
led4:C
led5:A
led5:C
led6:A
led6:C
led7:A
led7:C
led8:A
led8:C
led9:A
led9:C
led10:A
led10:C
led12:A
led12:C
led13:A
led13:C
led14:A
led14:C
led15:A
led15:C
led16:A
led16:C
led17:A
led17:C
led18:A
led18:C
led19:A
led19:C
led11:A
led11:C
led20:A
led20:C
led21:A
led21:C
led22:A
led22:C
led23:A
led23:C
led24:A
led24:C
led25:A
led25:C
led26:A
led26:C
led27:A
led27:C
led28:A
led28:C
led29:A
led29:C
r29:1
r29:2
Q0
Q1
Q2
Q3
Q4
Q5
Q6
Q7
QH
___
QH
CLK
SH/LD
led30:A
led30:C
led31:A
led31:C
led32:A
led32:C
led33:A
led33:C
led34:A
led34:C
led35:A
led35:C
led36:A
led36:C
led37:A
led37:C
led38:A
led38:C
led39:A
led39:C
led40:A
led40:C
led41:A
led41:C
led42:A
led42:C
led43:A
led43:C
led44:A
led44:C
led45:A
led45:C
led46:A
led46:C
led47:A
led47:C
led48:A
led48:C
led49:A
led49:C
led50:A
led50:C
led51:A
led51:C
led52:A
led52:C
led53:A
led53:C
led54:A
led54:C
led55:A
led55:C
led56:A
led56:C
led57:A
led57:C
gnd1:GND
vcc1:VCC
vcc2:VCC
vcc3:VCC
vcc4:VCC
vcc5:VCC
vcc6:VCC
vcc7:VCC
vcc8:VCC
vcc9:VCC
vcc10:VCC
gnd2:GND
gnd3:GND
gnd4:GND
gnd5:GND
gnd6:GND
gnd7:GND
gnd8:GND
gnd9:GND
gnd10:GND
vcc11:VCC
r1:1
r1:2
ERC Warnings
flop1:CLK: Clock driven by combinatorial logic
flop2:CLK: Clock driven by combinatorial logic
flop3:CLK: Clock driven by combinatorial logic
flop4:CLK: Clock driven by combinatorial logic
flop5:CLK: Clock driven by combinatorial logic
flop6:CLK: Clock driven by combinatorial logic
flop7:CLK: Clock driven by combinatorial logic
flop8:CLK: Clock driven by combinatorial logic