## Animated Demonstration of an Amazing Design in an 8*8 LED Matrix (Page 3)

by realfinetime  |  in LED Matrix at  21:06

Step 14:
Turn off all LEDs. For that, shift out 0 to 1st 74595 and 255 to 2nd 74595. This will turn off all LEDs.

Step 15:
In 'j' loop, j=1. Shift out 2 (anode_decimal[j]) to 1st 74595 and 85 (cathode_decimal[j]) to 2nd 74595. Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595 becomes 0 0 0 0 0 0 1 0. Similarly, Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595 becomes 0 1 0 1 0 1 0 1. Now the LED matrix will be as shown below. This step will be done 5 times (i loop) to increase the brightness.

Step 16:
Turn off all LEDs. For that, shift out 0 to 1st 74595 and 255 to 2nd 74595. This will turn off all LEDs.

Step 17:
In 'j' loop, j=2. Shift out 4 (anode_decimal[j]) to 1st 74595 and 170 (cathode_decimal[j]) to 2nd 74595. Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595 becomes 0 0 0 0 0 1 0 0. Similarly, Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595 becomes 1 0 1 0 1 0 1 0. Now the LED matrix will be as shown below. This step will be done 5 times (i loop) to increase the brightness.

Step 18:
Turn off all LEDs. For that, shift out 0 to 1st 74595 and 255 to 2nd 74595. This will turn off all LEDs.

Step 19:
In 'j' loop, j=3. Shift out 8 (anode_decimal[j]) to 1st 74595 and 85 (cathode_decimal[j]) to 2nd 74595. Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595 becomes 0 0 0 0 1 0 0 0. Similarly, Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595 becomes 0 1 0 1 0 1 0 1. Now the LED matrix will be as shown below. This step will be done 5 times (i loop) to increase the brightness.

Step 20:
Turn off all LEDs. For that, shift out 0 to 1st 74595 and 255 to 2nd 74595. This will turn off all LEDs.

'j' loop will be continued for values 4, 5 and 6.

Step 21:
In 'j' loop, j=7. Shift out 128 (anode_decimal[j]) to 1st 74595 and 85 (cathode_decimal[j]) to 2nd 74595. Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595 becomes 1 0 0 0 0 0 0 0. Similarly, Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595 becomes 0 1 0 1 0 1 0 1. Now the LED matrix will be as shown below. This step will be done 5 times (i loop) to increase the brightness.

Step 22:
Turn off all LEDs. For that, shift out 0 to 1st 74595 and 255 to 2nd 74595. This will turn off all LEDs.

Step 13 to Step 22 will be executed quickly and by persistence of vision, matrix will look like as shown below. We have to keep the LED matrix in this state for some time. Here comes the use of 'k' loop. For this, Step 13 to Step 22 will be executed 25 times. This will keep the LED matrix in this state for a few seconds.

Step 23:
Now, rotate the cathode_decimal[] array one position towards left. Following part of program rotate the array one position towards left.

```  // Copy the first element of 'cathode_decimal' array to 'temp'.
temp=cathode_decimal;

/**** Shift all the elements of cathode_decimal array, other than first element,
one position towards left ****/
for(i=1;i<length_of_cathode_decimal_array;i++)
{
cathode_decimal[i-1]=cathode_decimal[i];
}

/**** Copy the value in 'temp' to last position of 'cathode_decimal' array.
Then first element in old array becomes last element in new array ****/
cathode_decimal[length_of_cathode_decimal_array-1]=temp; ```

Now 'cathode_decimal' array will become:

anode_decimal[]={1, 2, 4, 8, 16, 32, 64, 128}
cathode_decimal[]={85, 170, 85, 170, 85, 170, 85, 170}

That is, 'cathode_decimal' array had returned to its previous state. Now the processes will be continued again from step 1 in an infinite while loop. This will give the LED matrix illumination as shown below.