#define SERIN_PIN 3
#define CLK_PIN 2
#define SHLD_PIN 4
void setup() {
pinMode(CLK_PIN, OUTPUT);
pinMode(SHLD_PIN, OUTPUT);
pinMode(SERIN_PIN, INPUT);
Serial.begin(9600);
}
void loop() {
// SH_PIN is HIGH as default
// Put SH_PIN to LOW and then rise up to HIGH to read the values
digitalWrite(SHLD_PIN, HIGH);
digitalWrite(CLK_PIN, HIGH);
delay(1);
digitalWrite(SHLD_PIN, LOW);
digitalWrite(CLK_PIN, LOW);
delay(1);
digitalWrite(SHLD_PIN, HIGH);
digitalWrite(CLK_PIN, HIGH);
delay(1);
// REad value from register
unsigned int val = shiftIn(SERIN_PIN, CLK_PIN, LSBFIRST);
//Serial.print("Input value: ");
Serial.println(val, BIN);
delay(2500);
}