Introduction: Shift Register
A shift register is used for serial input and parallel output. The arduno has limitations of input/output pins,with the help of shift register output pins can be increased
Supplies
Given below
Step 1: COMPONENTS REQUIRED
×8 (1K-resistors)
×1(74HC595)
×1(arduno uno)
×19(male wires)
×1(74HC595)
×1(arduno uno)
×19(male wires)
Step 2: Main CODE
const int DataPin= 2;
const int clockPin= 3;
const int LatchPin= 4;
could setup( )
{
pinMode(DataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(LatchPin,OUTPUT);
}
voild loop( )
{
digitalWrite(LatchPin, LOW);
shutout(DataPin, clockPin, LSBFIRST , 255 );
digitalWrite (LatchPin, HIGH);
delay(1000);
digitalWrite(LatchPin, LOW);
shiftout(DataPin, clockPin, LSBFIRST, 0);
digitalWrite (LatchPin ,HIGH);
delay(1000);
}
const int clockPin= 3;
const int LatchPin= 4;
could setup( )
{
pinMode(DataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(LatchPin,OUTPUT);
}
voild loop( )
{
digitalWrite(LatchPin, LOW);
shutout(DataPin, clockPin, LSBFIRST , 255 );
digitalWrite (LatchPin, HIGH);
delay(1000);
digitalWrite(LatchPin, LOW);
shiftout(DataPin, clockPin, LSBFIRST, 0);
digitalWrite (LatchPin ,HIGH);
delay(1000);
}
Step 3: SCHEMATICS
Digital pins =4, 3,2
Negative pin= gnd
Positive pin= +5
Negative pin= gnd
Positive pin= +5
Step 4: TROUBLE Shooting
Showing wrong pattern : try changing LSBFIRST/HSBFIRST in shutout command