digitalWrite(latchPin,HIGH);//Output data of two stage 74HC595 at the
same time
x>>=1;// display the next column
delay( 1);
}
}
for(k=0;k<sizeof(data)-8;k++){ //sizeof(data) total number of "0-F" columns
for(j=0;j<20;j++){// times of repeated displaying LEDMatrix in every frame,
the bigger the “j”, the longer the display time
x= 0x80; // Set the column information to start from the first column
for(i=k;i<8+k;i++){
digitalWrite(latchPin,LOW);
_shiftOut(dataPin,clockPin,MSBFIRST,data[i]);
_shiftOut(dataPin,clockPin,MSBFIRST,~x);
digitalWrite(latchPin,HIGH);
x>>=1;
delay( 1);
}
}
}
}
r eturn 0;
}
The first “for” cycle in the “while” cycle is used to display a static smile. Display column information from left
to right, one column by one column, totally 8 columns. Repeat 500 times to ensure display time enough.
for(j=0;j<500;j++){// Repeat enough times to display the smiling face a period
of time
x=0x80;
for(i=0;i<8;i++){
digitalWrite(latchPin,LOW);
shiftOut(dataPin,clockPin,MSBFIRST,pic[i]);
shiftOut(dataPin,clockPin,MSBFIRST,~x);
digitalWrite(latchPin,HIGH);
x>>=1;
delay(1);
}
}