SunFounder Da Vinci Kit
i
range(0,3):
for
in
GPIO.output(ledPin[i], GPIO.HIGH)
GPIO.output(ledPin[colorState], GPIO.LOW)
def
display():
global
counter
a
=
counter
%
10000//1000
b
=
counter
%
10000//1000
c
=
counter
%
10000//1000
if
(counter
%
10000//1000
clearDisplay()
else:
clearDisplay()
pickDigit(3)
hc595_shift(number[counter
if
(a
==
0):
clearDisplay()
else:
clearDisplay()
pickDigit(2)
hc595_shift(number[counter
if
(b
==
0):
clearDisplay()
else:
clearDisplay()
pickDigit(1)
hc595_shift(number[counter
if(c
==
0):
clearDisplay()
else:
clearDisplay()
pickDigit(0)
hc595_shift(number[counter
def
loop():
while
True:
display()
lightup()
def
destroy():
# When "Ctrl+C" is pressed, the function is executed.
global
timer1
GPIO.cleanup()
timer1.cancel()
if
__name__
==
'__main__':
setup()
try:
loop()
except
KeyboardInterrupt:
destroy()
Code Erklärung
326
+
counter
%
1000//100
+
counter
%
1000//100
+
counter
%
1000//100
==
0):
%
10000//1000])
%
1000//100])
%
100//10])
%
10])
#cancel the timer
# Program starting from here
(Fortsetzung der vorherigen Seite)
+
counter
%
100//10
+
counter
%
100//10
Kapitel 1. Über das Da Vinci Kit
+
counter
%
10