EasyManua.ls Logo

Freenove Ultimate Starter Kit - Page 285

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
Loading...
285
Chapter 27 Solder Circuit Board
www.freenove.com
support@freenove.com
Finally, in a for cycle with i=64, modulate output pulse width of PWM square wave. And the progress, from
the beginning of implementing the for cycle to the end, is a PWM cycle. In the cycle, there is another for cycle
with j=8. And in this cycle, compare the cycle number “i” to the value of the array to determine output high
or low level. At last, the data will be sent to 74HC595.
for i in range( 0,64): #The cycle of PWM is 64 cycles
data = 0 #This loop of output data
for j in range(0,8): #Calculate the output state of this loop
if(i < pluseWidth[j+index]): #Calculate the LED state according to the
pulse width
data |= 1<<j #Calculate the data
outData(data) #Send the data to 74HC595

Table of Contents