SunFounder Da Vinci Kit
def
setup():
# ...
global
timer1
timer1
=
threading.Timer(1.0,timer)
timer1.start()
def
loop():
True:
while
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()
Starten Sie in der Funktion setup() den Timer. In der Funktion loop() wird eine Weile True verwendet: Rufen Sie die
relativen Funktionen von 4-stelligem 7-Segment und LED kreisförmig auf.
Phänomen Bild
328
#cancel the timer
# Program starting from here
Kapitel 1. Über das Da Vinci Kit