Herunterladen Inhalt Inhalt Diese Seite drucken

SunFounder Da Vinci Kit Bedienungsanleitung Seite 282

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
Sie jedoch zu einem Quellcodepfad wie davinci-kit-for-raspberry-pi\\python gehen.
import
RPi.GPIO
as
import
time
sensorPin
=
26
SDI
=
24
RCLK
=
23
SRCLK
=
18
placePin
=
(10, 22, 27, 17)
number
=
(0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90)
counter
=
0
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
display():
global
counter
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
loop():
counter
global
278
GPIO
0x80
&
(data
%
10])
%
100//10])
%
1000//100])
%
10000//1000])
<<
i))
(Fortsetzung auf der nächsten 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