HD74LS164 8-Bit Parallel-Out Serial-in Shift Register

Used Products:

1. Arduino UNO
2. HD74LS164P

Content:

Çeşme: http://www.bristolwatch.com/arduino/arduino3.htm

Code:

#define BIT_OUT 12 #define CLK 11 #define CLR 10 int counter = 0; byte temp; byte array[] = { B00000000, B00000001, B00000010, B00000100, B00001000, B00010000, B00100000, B01000000, B10000000 }; void setup() { pinMode(BIT_OUT, OUTPUT); pinMode(CLK, OUTPUT); pinMode(CLR, OUTPUT); digitalWrite(CLK, 0); digitalWrite(CLR, 1); } void loop() { if (counter > 8) { counter = 0; digitalWrite(CLR, 0); digitalWrite(CLR, 1); } temp = B10101010; temp = array[counter]; counter++; digitalWrite(BIT_OUT, temp); digitalWrite(CLK, 1); digitalWrite(CLK, 0); delay(100); }