SunFounder Da Vinci Kit
GPIO.output(SDI,
GPIO.output(SRCLK, GPIO.HIGH)
GPIO.output(SRCLK, GPIO.LOW)
GPIO.output(RCLK, GPIO.HIGH)
GPIO.output(RCLK, GPIO.LOW)
pickDigit(digit):
def
for
i
in
placePin:
GPIO.output(i,GPIO.LOW)
GPIO.output(placePin[digit], GPIO.HIGH)
def
timer():
global
counter
global
timer1
timer1
=
threading.Timer(1.0, timer)
timer1.start()
counter
+=
1
print("%d"
%
counter)
def
loop():
global
counter
while
True:
clearDisplay()
pickDigit(0)
hc595_shift(number[counter
clearDisplay()
pickDigit(1)
hc595_shift(number[counter
clearDisplay()
pickDigit(2)
hc595_shift(number[counter
clearDisplay()
pickDigit(3)
hc595_shift(number[counter
def
setup():
GPIO.setmode(GPIO.BCM)
GPIO.setup(SDI, GPIO.OUT)
GPIO.setup(RCLK, GPIO.OUT)
GPIO.setup(SRCLK, GPIO.OUT)
for
i
in
placePin:
GPIO.setup(i, GPIO.OUT)
global
timer1
timer1
=
threading.Timer(1.0, timer)
timer1.start()
def
destroy():
# When "Ctrl+C" is pressed, the function is executed.
global
timer1
GPIO.cleanup()
timer1.cancel()
74
0x80
&
(data
<<
%
10])
%
100//10])
%
1000//100])
%
10000//1000])
# cancel the timer
i))
Kapitel 1. Über das Da Vinci Kit
(Fortsetzung der vorherigen Seite)
(Fortsetzung auf der nächsten Seite)