Herunterladen Inhalt Inhalt Diese Seite drucken

SunFounder Da Vinci Kit Bedienungsanleitung Seite 329

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

counter
=
60
timer1
=
0
def
setup():
GPIO.setmode(GPIO.BCM)
GPIO.setup(SDI, GPIO.OUT)
GPIO.setup(RCLK, GPIO.OUT)
GPIO.setup(SRCLK, GPIO.OUT)
pin
placePin:
for
in
GPIO.setup(pin,GPIO.OUT)
for
pin
in
ledPin:
GPIO.setup(pin,GPIO.OUT)
global
timer1
timer1
=
threading.Timer(1.0,timer)
timer1.start()
def
clearDisplay():
for
i
in
range(8):
GPIO.output(SDI, 1)
GPIO.output(SRCLK, GPIO.HIGH)
GPIO.output(SRCLK, GPIO.LOW)
GPIO.output(RCLK, GPIO.HIGH)
GPIO.output(RCLK, GPIO.LOW)
def
hc595_shift(data):
for
i
in
range(8):
GPIO.output(SDI,
GPIO.output(SRCLK, GPIO.HIGH)
GPIO.output(SRCLK, GPIO.LOW)
GPIO.output(RCLK, GPIO.HIGH)
GPIO.output(RCLK, GPIO.LOW)
def
pickDigit(digit):
for
i
in
placePin:
GPIO.output(i,GPIO.LOW)
GPIO.output(placePin[digit], GPIO.HIGH)
def
timer():
global
counter
global
colorState
global
timer1
timer1
=
threading.Timer(1.0,timer)
timer1.start()
counter-=1
if
(counter
is
if(colorState
counter=
if(colorState
counter=yellowLight
if
(colorState
counter=redLight
colorState=(colorState+1)%3
print
("counter :
def
lightup():
global
colorState
1.9. 3 Erweiterung
0x80
&
(data
#timer function
0):
is
0):
greenLight
is
1):
is
2):
%d
color:
%s
<<
i))
"%(counter,lightColor[colorState]))
SunFounder Da Vinci Kit
(Fortsetzung der vorherigen Seite)
(Fortsetzung auf der nächsten Seite)
325

Werbung

Inhaltsverzeichnis
loading

Verwandte Produkte für SunFounder Da Vinci Kit

Diese Anleitung auch für:

Davinci-kit-for-raspberry-pi

Inhaltsverzeichnis