int latchPin = 7; int clockPin = 5; int dataPin = 6; int count = 0; void setup() { pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); } void loop() { PORTD &= ~(1<<7);//digitalWrite(latchPin,LOW); shiftOut(count); PORTD |= (1<<7);//digitalWrite(latchPin,HIGH); delay(1000); if(count == 0) count = 1; else count = 0; } void shiftOut(long myDataOut) { int pinState; int outPut; for (outPut=24; outPut >= 0; outPut--) //24 different outputs { for(int val = 11; val >= 0; val--) //12 bit number { PORTD &= ~(1<<5); if ( count == 1 ) { pinState = 1; } else { pinState= 0; } if(pinState == 0) PORTD &= ~(1<<6); else PORTD |= (1<<6); PORTD |= (1<<5); PORTD &= ~(1<<6); } } PORTD &= ~(1<<5); }