EasyManuals Logo

Freenove Ultimate Starter Kit User Manual

Freenove Ultimate Starter Kit
286 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #218 background imageLoading...
Page #218 background image
Chapter 19 74HC595 & LED Matrix
218
www.freenove.com
support@freenove.com
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
def shiftOut(dPin,cPin,order,val):
for i in range(0,8):
GPIO.output(cPin,GPIO.LOW);
if(order == LSBFIRST):
GPIO.output(dPin,(0x01&(val>>i)==0x01) and GPIO.HIGH or GPIO.LOW)
elif(order == MSBFIRST):
GPIO.output(dPin,(0x80&(val<<i)==0x80) and GPIO.HIGH or GPIO.LOW)
GPIO.output(cPin,GPIO.HIGH);
def loop():
w hile Tr ue:
for j in range(0,500):# Repeat enough times to display the smiling face a period
of time
x=0x80
for i in range(0,8):
GPIO. output(latchPin,GPIO.LOW)
shiftOut(dataPin,clockPin,MSBFIRST,pic[i]) #first shift data of line
information to first stage 74HC959
shiftOut(dataPin,clockPin,MSBFIRST,~x) #then shift data of column
information to second stage 74HC959
GPIO. output(latchPin,GPIO.HIGH)# Output data of two stage 74HC595 at the
same time
time. sleep(0.001)# display the next column
x>>=1
for k in range(0,len(data)-8):#len(data) total number of "0-F" columns
for j in range(0,20):# 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
f or i in range(k,k+8):
GPIO. output(latchPin,GPIO.LOW)
shiftOut(dataPin,clockPin,MSBFIRST,data[i])
shiftOut(dataPin,clockPin,MSBFIRST,~x)
GPIO. output(latchPin,GPIO.HIGH)
time. sleep(0.001)
x>>=1
def destroy(): # When 'Ctrl+C' is pressed, the function is executed.
GPIO. cleanup()
if __name__ == '__main__': # Program starting from here
p rint ('Program is starting...' )
setup()
try:
loop()

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Freenove Ultimate Starter Kit and is the answer not in the manual?

Freenove Ultimate Starter Kit Specifications

General IconGeneral
BrandFreenove
ModelUltimate Starter Kit
CategorySingle board computers
LanguageEnglish