// by NMDWeerasinghe @COTMD 
// Using Seperate Clock lines and common Latch and common data lines

const int dataPin1 = 2;   /* DS */
const int clockPin1 = 3;  /* SHCP */
const int latchPin1 = 4;  /* STCP */
//const int dataPin2 = 5;   /* DS */
const int clockPin2 = 6;  /* SHCP */ //Seperate clock pin
//const int latchPin2 = 7;  /* STCP */
const int clockPin3 = 8;  /* SHCP */ //Seperate clock pin

int pattern1;
int pattern2;
int pattern3;

void setup() {
  for(int i = 2; i<9; i++)
   {
      pinMode(i, OUTPUT);
   }

 pattern1 = 0b10111110;//1
 pattern2 = 0b11110110;//9
 pattern3 = 0b10111110;//6

  digitalWrite(latchPin1, LOW);
  shiftOut(dataPin1, clockPin1, LSBFIRST, pattern1);
  digitalWrite(latchPin1, HIGH);
  delay(10);
  digitalWrite(latchPin1, LOW);
  shiftOut(dataPin1, clockPin2, LSBFIRST, pattern2);
  digitalWrite(latchPin1, HIGH);
  delay(10);
  digitalWrite(latchPin1, LOW);
  shiftOut(dataPin1, clockPin3, LSBFIRST, pattern3);
  digitalWrite(latchPin1, HIGH);
  delay(1500);
  digitalWrite(latchPin1, LOW);
  shiftOut(dataPin1, clockPin1, LSBFIRST, 0b01100110);
  digitalWrite(latchPin1, HIGH);
  delay(1500);
  digitalWrite(latchPin1, LOW);
  shiftOut(dataPin1, clockPin2, LSBFIRST, 0b11100000);
  digitalWrite(latchPin1, HIGH);
  delay(10);

}


void loop() {
  
  //pattern = ~pattern; // Invert the pattern
}
74HC595
74HC595
74HC595
D0D1D2D3D4D5D6D7GNDLOGIC