Herunterladen Inhalt Inhalt Diese Seite drucken

SunFounder Da Vinci Kit Bedienungsanleitung Seite 396

Für den raspberry pi 4 modell b, 3 modell a +, 3 modell b +, 3 modell b, 2 modell b, 1 modell b +, 1 modell a +, zero w and zero
Inhaltsverzeichnis

Werbung

SunFounder Da Vinci Kit
GPIO.output(RCLK, GPIO.HIGH)
GPIO.output(RCLK, GPIO.LOW)
creatGlyph():
def
global
waypoint
global
stage
timerPlay
global
waypoint=random.choice(list(arrow.keys()))
stage
=
"PLAY"
timerPlay
=
threading.Timer(2.0, timeOut)
timerPlay.start()
def
checkPoint(inputKey):
global
waypoint
global
stage
global
timerCheck
if
inputKey
==
waypoint
=
else:
waypoint
=
timerPlay.cancel()
stage
=
"CHECK"
timerCheck
=
threading.Timer(1.0, creatGlyph)
timerCheck.start()
def
timeOut():
checkPoint("empty")
def
getKey():
if
GPIO.input(AButtonPin)==1
checkPoint("right")
elif
GPIO.input(AButtonPin)==0
checkPoint("left")
def
main():
creatGlyph()
while
True:
if
stage
==
display(arrow[waypoint])
getKey()
elif
stage
display(check[waypoint])
def
destroy():
global
timer1
GPIO.cleanup()
timerPlay.cancel()
timerCheck.cancel()
if
__name__
==
'__main__':
setup()
try:
main()
except
KeyboardInterrupt:
destroy()
Code Erklärung
392
"empty"
or
inputKey
"wrong"
"right"
and
GPIO.input(BButtonPin)==0:
and
"PLAY":
==
"CHECK":
# cancel the timer
==
waypoint:
GPIO.input(BButtonPin)==1:
(Fortsetzung der vorherigen Seite)
Kapitel 1. Über das Da Vinci Kit

Werbung

Inhaltsverzeichnis
loading

Verwandte Produkte für SunFounder Da Vinci Kit

Diese Anleitung auch für:

Davinci-kit-for-raspberry-pi

Inhaltsverzeichnis