Herunterladen Inhalt Inhalt Diese Seite drucken

Joy-it JoyPi Bedienungsanleitung Seite 43

Vorschau ausblenden Andere Handbücher für JoyPi:
Inhaltsverzeichnis

Werbung

def
main():
#initialisieren der Buttonmatrix
buttons = ButtonMatrix()
try:
while
True:
for
except
KeyboardInterrupt:
GPIO.cleanup()
if
_name_ == "_main_":
main()
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
cd
/home/pi/Desktop/Joy-Pi/
sudo python button_matrix.py
Veröffentlicht: 04.10.2018
j
in
range(len(buttons.columnPins)):
#setze Ausgangspins auf LOW
GPIO.output(buttons.columnPins[j], 0)
for
i
in
range(len(buttons.rowPins)):
if
GPIO.input(buttons.rowPins[i]) == 0:
#knopf gedrückt, aktivieren
buttons.activateButton(i, j)
#mache nichts solange knopf gedrückt bleibt
While(buttons.buttonHeldDown(i)):
#setze Ausgangspins auf HIGH
GPIO.output(buttons.columnPins[j], 1)
Copyright by Joy-IT
pass
JoyPi
43

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis