User Manual
108
Note: PLEASE connect devices correctly. DO NOT wire up insufficiently. DO NOT connect to
the wrong side of the dot matrix. In the Fritzing image above, the side with label is at the
bottom.
For C language users:
Step 2: Get into the folder of code
cd /home/pi/SunFounder_Super_Kit_V3.0_for_Raspberry_Pi/C
Step 3: Compile
make 15_dotMatrix
Step 4: Run
sudo ./15_dotMatrix
Code Explanation
void hc595_in(unsigned char dat){ // Write an 8-bit data to the shift register of the
74HC595
int i;
for(i=0;i<8;i++){
digitalWrite(SDI, 0x80 & (dat << i)); // Write the value of dat to pin SDI of
the HC595 bit by bit
digitalWrite(SRCLK, 1); // Everytime SRCLK adds one, the shift register moves 1
bit
delay(1);
digitalWrite(SRCLK, 0);
}
SunFounder