Joy-iT Joy-Pi User Manual [de]

Page 1
3
Joy-Pi
Page 2
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 2
Joy-Pi
2. Details
3. Modulwechsel und Verwendung der GPIOs
4. Verwendung von Python und Linux
5. Lekonen
5.1 Lekon 1: Verwenden des Buzzers für Warntöne
5.2 Lekon 2: Buzzer mit Taster steuern
5.3 Lekon 3: Wie ein Relais funkoniert und wie man es steuert
5.4 Lekon 4: Senden Sie ein Vibraonssignal
5.5 Lekon 5: Geräusche mit dem Schallsensor erkennen
5.6 Lekon 6: Erkennen der Helligkeit mit dem Lichtsensor
5.7 Lekon 7: Erkennen der Temperatur und der Lufeuchgkeit
5.8 Lekon 8: Bewegungen erkennen
5.9 Lekon 9: Enernungen mit dem Ultraschallsensor messen
5.10 Lekon 10: Steuern des LCD-Displays
5.11 Lekon 11: Lesen und Schreiben von RFID-Karten
5.12 Lekon 12: Schrimotoren verwenden
5.13 Lekon 13: Steuerung von Servomotoren
5.14 Lekon 14: Steuern der 8x8 LED-Matrix
5.15 Lekon 15: Steuern des 7-Segment-Displays
5.16 Lekon 16: Berührungen erkennen
5.17 Lekon 17: Neigungen mit dem Neigungssensor erkennen
5.18 Lekon 18: Verwenden der Taster-Matrix
5.19 Lekon 19: Steuern und verwenden des IR-Sensors
5.20 Lekon 20: Eigene Schaltungen mit dem Breadboard
5.21 Lekon 21: Fotograeren mit der Raspberry Pi-Kamera
6. Informaons- und Rücknahmepichten
7. Rechtliches
8. Support
INHALTSVERZEICHNIS
Page 3
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 3
Joy-Pi
Sehr geehrter Kunde, vielen Dank, dass Sie sich für unser Produkt entschieden haben. Im Folgenden zeigen wir Ihnen, was bei der Inbetriebnahme und der Verwendung zu beachten ist. Sollten Sie während der Verwendung unerwartet auf Probleme stoßen, so können Sie uns selbstverständlich
gerne kontakeren.
Die folgenden Lekonen sind so konzipiert, dass Sie, unabhängig davon wie viel Vorwissen Sie bereits haben, alle Lekonen ohne Probleme ausführen können. Für die verschiedenen Lekonen müssen Sie Beispieldateien herunterladen und auf dem Joy-Pi ausführen. Wie Sie dies durchführen, können Sie ebenfalls dieser Anleitung entnehmen.
Doch diese Tutorials sind nur der Anfang. Wir freuen uns darauf zu sehen, was Sie mit unserem Joy-Pi machen werden.
1. ÜBERSICHT
2. DETAILS
Die Anmeldedaten sind: Username: pi Passwort: 12345
27
26
Page 4
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 4
Joy-Pi
1 Raspberry Pi 2 GPIO LED Anzeige 3 Breadboard - zur Erstellung benutzerdenierter Schaltungen mit externen Modulen 4 16x2 LCD Modul (MCP23008) 5 Stromversorgung 6 8x8 LED Matrix (MAX7219) 7 7 Segment LED Anzeige (HT16K33) 8 Vibraonsmodul
9 Lichtsensor (BH1750) 10 Buzzer - zur Erzeugung von Alarmtönen 11 Schallsensor 12 Bewegungssensor (LH1778) 13 Ultraschallabstandssensor
14 / 15 Servo-Schnistellen
16 Schrimotor-Schnistelle 17 Neigungssensor (SW-200D) 18 Infrarotsensor 19 Berührungssensor 20 DHT11 Temperatur– und Lufeuchgkeitssensor 21 Relais 22 Taster-Matrix 23 unabhängige Taster 24 RFID Modul(MFRC522) 25 Schalter - zum Umschalten zwischen Sensoren und Modulen 26 Lüeranschluss 27 Stromversorgung Micro-USB
Page 5
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 5
Joy-Pi
MODULWECHSEL
Auf der Joy-Pi-Plane benden sich zwei Schaltereinheiten à 8 Schalter. Die Schalter ermöglichen es, zwischen verschiedenen Sensoren und Modulen zu wechseln. Da der Raspberry Pi nur eine begrenzte Anzahl an GPIO-Pins hat, werden diese Schalter benögt um mehr Sensoren und Module verwenden zu können als GPIO-Pins vorhanden sind.
Die Verwendung dieser Schalter ist ziemlich einfach und wird in einigen der folgenden Lekonen benögt.
In der Tabelle sehen Sie, welcher Schalter welchen Sensor bzw. welches Modul schaltet:
3. MODULWECHSEL UND VERWENDUNG DER GPIOS
Sensoren / Module Schalteinheit Schalter
Taster-Matrix Links 1 - 8
unabhängige Taster Links 5 - 8
Vibraonsmodul Rechts 1
Neigungssensor Rechts 2
Schrimotor Rechts 3, 4, 5, 6
Servomotor Rechts 7, 8
Page 6
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 6
Joy-Pi
VERWENDUNG DER GPIOS
Im Folgenden werden wir Ihnen genauer erläutern, was GPIO-Pins sind, wie diese funkonieren und wie diese gesteuert werden.
GPIO steht für: General-purpose input / output(Universal Eingang / Ausgang). GPIO-Pins haben keine festgelegte Funkon. Es kann konguriert werden, ob die GPIO-Pins als digitaler Eingang oder als digitaler Ausgang dienen.
Beispiel Eingangs-Pin: Taster Wenn der Taster gedrückt wird, gelangt das Signal zur weiteren Verarbeitung über den Eingang-Pin zum
Raspberry Pi.
Beispiel Ausgangs-Pin: Buzzer Über den Ausgangs-Pin wird ein Signal in Richtung Buzzer gesendet, um diesen zu steuern.
Wenn Sie den geöneten Joy-Pi von vorne betrachten, benden sich die GPIO-Pins auf der rechten Seite des Raspberry Pis.
Page 7
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 7
Joy-Pi
Es gibt 2 mögliche Raspberry Pi GPIO Schemata: GPIO-BOARD und GPIO-BCM Die GPIO-BOARD Opon gibt an, dass Sie sich auf die Pins anhand der Nummer des Pins beziehen. Das heißt es werden die unten voranstehenden Pin-Nummern verwendet.
Die Opon GPIO.BCM bedeutet, dass Sie sich auf die Pins des "Broadcom SOC Channel" beziehen. Dies sind die Zahlen nach "GPIO".
1 3.3V DC 3 GPIO 2 (SDA1, I2C) 5 GPIO 3 (SCL1, I2C) 7 GPIO 4
9 Ground 11 GPIO 17 13 GPIO 27 15 GPIO 22
17 3.3V
19 GPIO 10 (SPI, MOSI) 21 GPIO 9 (SPI, MISO) 23 GPIO 11 (SPI, CLK) 25 Ground 27 ID_SD (I2C, EEPROM) 29 GPIO 5 31 GPIO 6 33 GPIO 13
35 GPIO 19
37 GPIO 26 39 Ground
2 5V DC 4 5V DC 6 Ground
8 GPIO 14 (TXD0) 10 GPIO 15 (RXD0) 12 GPIO 18 14 Ground 16 GPIO 23
18 GPIO 24
20 Ground 22 GPIO 25 24 GPIO 8 (SPI) 26 GPIO 7 (SPI) 28 ID_SC 30 Ground 32 GPIO 12 34 Ground
36 GPIO 16
38 GPIO 20 40 GPIO 21
GPIO-Board
Nummer:
GPIO-Board
Nummer:
Page 8
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 8
Joy-Pi
BELEGUNG NACH GPIO-BOARD-SCHEMA
GPIO-BOARD Nummer:
Sensoren und Module
1 3.3V 2 5.0V 3 I2C, SDA1 (Licht Sensor, LCD Display, 7 Segment Display) 4 5.0V 5 I2C, SCL1 (Licht Sensor, LCD Display, 7 Segment Display) 6 Ground 7 DHT11 Sensor 8 TXD0
9 Ground 10 RXD0 11 Touch Sensor 12 Buzzer 13 Schallächenmatrix (ROW1), Vibraonsmotor 14 Ground 15 Schallächenmatrix (ROW2), Neigungssensor 16 Bewegungssensor 17 3.3V 18 Schallsensor 19 SPI 20 Ground
21 SPI
22 Servo2, Schallächenmatrix (COL1), Le Buon 23 SPI 24 RFID Modul 25 Ground 26 LED-MATRIX 27 ID_SD (I2C, EEPROM(Electrically Erasable Programmable Read-only Memory)) 28 ID_SC 29 Schrimotor (STEP1), Schallächenmatrix (ROW3) 30 Ground 31 Schrimotor (STEP2), Schallächenmatrix (ROW4)
32 Ultraschallsensor (Echo)
33 Schrimotor (STEP3), Schallächenmatrix (COL4), Down Buon 34 Ground 35 Schrimotor (STEP4), Schallächenmatrix (COL3), Right Buon 36 Ultraschallsensor (TRIG) 37 Servo1, Schallächenmatrix (COL2), Up Buon 38 Infrarot Sensor 39 Ground 40 Relais
Page 9
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 9
Joy-Pi
In unseren Beispielen verwenden wir die Programmiersprache Python“, um die GPIO-Pins zu steuern. In Python gibt es eine Bibliothek namens "RPi.GPIO". Dies ist eine Bibliothek, die dabei hil, die Pins mit Python zu steuern.
Das folgende Beispiel und die Kommentare im Code sollen Ihnen helfen das Programm zu verstehen.
Als Erstes müssen die benögten Bibliotheken mit Hilfe des „import“ Befehls imporert werden. Die Variablen „TOUCH“ und „BUZZER“ verweisen auf die Pins des Touchsensors und des Buzzers. Im Anschluss wird mit „GPIO.setmode(GPIO.BOARD)“ das verwendete GPIO Schema deniert. Als Nächstes werden die zuvor festgelegten Variablen mit Hilfe des Befehls „GPIO.setup()“ als Ein– bzw. Ausgang konguriert. Pin 11 (TOUCH) wird als Eingang und PIN 12 (BUZZER) wird als Ausgang festgelegt.
Die Funkon mainfragt ab ob es eine Berührung des Touchsensors gibt. Ist dies der Fall wird die
Funkon do_smtausgeführt. Die Funkon do_smtdruckt den Text Touch wurde erkannt“, setzt dann den Buzzer-Pin HIGHund eine Sekunde später wieder LOW(der Buzzer summt eine Sekunde).
Um noch mehr über den Zweck und die Verwendung von GPIO zu erfahren, empfehlen wir Ihnen sich die ozielle Dokumentaon der Raspberry Pi Foundaon zum Thema GPIO anzuschauen.
hps://www.raspberrypi.org/documentaon/usage/gpio/
import RPi.GPIO as GPIO import time #importieren der Bibliotheken import signal
TOUCH = 11 #Deklaration der Pinne BUZZER = 12
def setup_gpio(): #Definition der Ein- und Ausgaenge
GPIO.setmode(GPIO.BOARD) GPIO.setup(TOUCH, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(BUZZER, GPIO.OUT)
def do_smt(channel): #Funktion zur Ausgabe das Touch erkannt wurde
print("Touch wurde erkannt") #und Ausgabe ueber den Buzzer GPIO.output(BUZZER, GPIO.HIGH) #Signal ausgabe time.sleep (1) #1 Sekunde warten GPIO.output(BUZZER, GPIO.LOW) #Signalausgabe stoppen
def main():
setup_gpio() try: #Pruefung ob ein Touch erkannt wurde GPIO.add_event_detect(TOUCH, GPIO.FALLING, callback=do_smt, bouncetime=200) signal.pause() except KeyboardInterrupt: #strg+c beendet das Programm pass finally: GPIO.cleanup()
if __name__ == '__main__':
main()
Page 10
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 10
Joy-Pi
SOFTWAREINSTALLATION FÜR DEN JOY-PI
Auf der mit gelieferten MicroSD Karte ist schon ein vorinstalliertes Betriebssystem aufgespielt. Wenn Sie die Karte neu beschreiben möchten, können Sie dies wie folgt durchführen:
Als erstes sollten Sie die aktuellste Image-Datei für den Joy-Pi, von unserer Website www.joy-pi.net herunterladen.
1. Laden Sie die Image-Datei (.zip Format) auf Ihren PC, nach dem Entpacken der Datei erhalten Sie eine Datei mit der Endung .img.
2. Schließen Sie eine MicroSD Karte an Ihren PC an und formaeren Sie diese mit dem Programm SD Formaer. Ein MicroSD Kartenlesegerät ist im Lieferumfang enthalten.
3. Starten Sie das Programm Win32 Disk Imagerund wählen Sie
1. die heruntergeladene Imagedatei aus
2. das zu beschreibende Laufwerk aus
danach klicken Sie auf die Schalläche Schreibenum das Image auf die Karte zu schreiben.
4. Nun ist die Karte mit dem Betriebssystem beschrieben und Sie können diese in den MicroSD-Kartenslot des Raspberry Pi Stecken.
5. Zum Schluss müssen Sie das Image noch auf die größe Ihrer SD-Karte anpassen.
Starten Sie dafür Ihren Raspberrry Pi, önen Sie das Terminal und geben sudo raspi-congein. Gehen Sie nun auf Advanced Oponsund dann auf Expand Filesystem“. Nach einem Neustart wurde die Image Größe auf Ihre SD-Karte angepasst.
Page 11
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 11
Joy-Pi
Dieser Schri ist oponal, macht es jedoch einfacher, Skripts auszuführen, ohne sie einzeln erstellen zu müssen. Auf der mitgelieferten micro-SD Karte benden sich die Skripte auf dem Desktop.
Die in dieser Anleitung verwendeten Skripte können direkt in einem Paket heruntergeladen werden. Folgen Sie dazu einfach den folgenden Anweisungen:
1. Önen Sie das "Terminal". Dies benutzen wir, um die meisten unserer Python Skripte auszuführen und
Erweiterungen und Skripte herunterzuladen.
2. Nachdem wir das Terminal erfolgreich geönet haben, müssen wir nun das Skriptarchiv mit dem folgenden Befehl auf den Desktop herunterladen:
3. Drücken Sie "Enter" auf Ihrer Tastatur. Nun muss das Archiv nur noch entpackt werden:
4. Drücken Sie "Enter" und warten Sie, bis der Vorgang abgeschlossen ist.
5. Mit dem Befehl "cd" wechseln wir in das richge Verzeichnis, damit wir die Skripte verwenden können, die sich darin benden:
4. VERWENDUNG VON PYTHON UND LINUX
cd Desktop/ wget http://anleitung.joy-it.net/wp-content/uploads/2019/01/Joy-Pi.zip
unzip Joy-Pi.zip
cd Joy-Pi
Achtung! Jedes Mal, wenn Sie Ihren Joy-Pi ausschalten, müssen Sie die Schrie des Verzeichniswechseln wiederholen.
Die Anmeldedaten sind: Username: pi Passwort: 12345
Page 12
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 12
Joy-Pi
AUSFÜHREN VON PYTHON SKRIPTS
Nachdem die Skripte erfolgreich von unserer Webseite heruntergeladen wurden, möchten wir es jetzt ausführen. Önen Sie erneut das Terminal und befolgen Sie die folgende Anweisung, um das Skript auszu­führen:
1. Geben Sie den Befehl "sudo python <script name>" ein, um ein Python-Skript auszuführen.
Zum Beispiel:
Der Befehl setzt sich aus 3 Teilen zusammen. Durch den Befehl sudowird der folgende Teil der Befehls­zeile mit root-Berechgungen (Admin-Berechgungen) ausgeführt. pythonist der Befehl der gleichna- migen Programmiersprache, in der die Skripte geschrieben sind. Am Ende steht der Name des Skripts. Hierbei ist zu beachten, dass man sich entweder in dem Ordner bendet, in dem das jeweilige Skript ge­speichert ist oder den Pfad (z. B. ~/Joy-Pi/buzzer.py“) angibt.
sudo python buzzer.py
Page 13
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 13
Joy-Pi
5.1 LEKTION 1: VERWENDEN DES BUZZERS FÜR WARNTÖNE
In der vorherigen Erklärung haben wir gelernt, wie man den GPIO-Pin sowohl als Ausgabe als auch als Eingabe verwendet. Um dies nun zu testen, gehen wir mit einem realen Beispiel voran und wenden unser Wissen aus der vorherigen Lekon an. Das Modul, welches wir verwenden werden, ist der "Buzzer".
Wir werden den GPIO-Ausgang verwenden, um ein Signal an den Buzzer zu senden und die Schaltung zu schließen, um ein lautes Summen zu erzeugen dann werden wir ein anderes Signal senden, um es auszuschalten.
Der Buzzer bendet sich auf der rechten Seite des Joy-Pi-Boards und ist durch das laute Geräusch, dass es
bei Akvierung macht leicht zu erkennen. Wenn Sie Ihren Raspberry Pi zum ersten Mal verwenden, ist der Buzzer möglicherweise mit einem Schutzauleber versehen. Stellen Sie sicher, dass dieser Auleber vor Gebrauch des Buzzers enernt wurde.
Genau wie im vorherigen Beispiel haben wir ein spezielles Skript mit detaillierten Kommentaren vorbereitet, die erklären werden, wie der gesamte Buzzer-Prozess funkoniert, und wie wir den Buzzer mit den GPIOs steuern können.
Zuerst imporeren wir die RPi.GPIO-Bibliothek und die me-bibliothek. Dann kongurieren wir den Buzzer. An Pin 12 richten wir den GPIO-Modus auf GPIO BOARD und den Pin als OUTPUT ein.
Wir geben ein Signal für 0,5 Sekunden aus und schalten dieses dann aus.
5. LEKTIONEN
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 14
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 14
Joy-Pi
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
#!/usr/bin/python
import RPi.GPIO as GPIO #importieren der benoetigten Bibliotheken import time
buzzer_pin = 12 #buzzer_pin wird definiert
GPIO.setmode(GPIO.BOARD) GPIO.setup(buzzer_pin, GPIO.OUT)
GPIO.output(buzzer_pin, GPIO.HIGH) #Gebe Geraeusch aus
time.sleep(0.5) #warte eine halbe Sekunde
GPIO.output(buzzer_pin, GPIO.LOW) #Stoppe Geraeuschausgabe
GPIO.cleanup()
sudo python buzzer.py
cd /home/pi/Desktop/Joy-Pi/
Page 15
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 15
Joy-Pi
5.2 LEKTION 2: BUZZER MIT TASTER STEUERN
Nach dem Sie nun wissen, wie man den Buzzer ein- und ausschaltet, ist es Zeit, die Dinge ein wenig aufregender zu gestalten. In dieser Lekon ein Taster mit dem Buzzer kombiniert, sodass der Buzzer nur durch Drücken des Tasters eingeschaltet wird.
Dieses Mal werden 2 GPIO-Setups verwendet. Einer wird der GPIO.INPUT sein, der den Taster als Eingabemöglichkeit einstellt, ein anderer wird der GPIO.OUTPUT sein, der ein Signal an den Buzzer sendet, um ein Geräusch auszugeben.
In diesem Beispiel wird der Obere der 4 Taster auf der unteren linken Seite verwendet. Theoresch kann
jedoch jeder der 4 Taster verwendet werden. Wenn Sie trotzdem einen anderen Taster verwenden möchten, müssen Sie die Pinbelegung dementsprechend ändern.
Achtung! Für dieses Beispiel müssen Sie zwischen den Modulen wechseln. Stellen Sie die Schalter Nummer 5, 6, 7 und 8 der linken Schalteinheit auf ON. Alle anderen Schalter sollten auf OFF stehen.
GPIO37 Oberer Taster GPIO33 Unterer Taster GPIO22 Linker Taster GPIO35 Rechter Taster
Page 16
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 16
Joy-Pi
Für diesen Teil des Tutorials müssen 2 GPIO-Einstellungen verwendet werden. Eine Eingabe und eine Ausgabe. Der GPIO-Eingang wird verwendet, um zu besmmen, wann ein Taster gedrückt wurde und die GPIO-Ausgabe wird verwendet, um den Buzzer zu akvieren, sobald dieser Taster gedrückt wird.
Wenn Sie den Taster auf Ihrem Joy-Pi drücken, ertönt der Buzzer! Lassen Sie den Taster los und der Buzzer verstummt. Das Programm läu solange bis STRG + C gedrückt wird.
Beispielcode:
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
#definiere Pins
button_pin = 37 buzzer_pin = 12
#setze Board Modus zu GPIO.BOARD
GPIO.setmode(GPIO.BOARD)
#lege button_pin als Eingang und buzzer_pin als Ausgang fest
GPIO.setup(button_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(buzzer_pin, GPIO.OUT)
try:
while True:
#ueberpruefe ob Knopf gedrueckt wird
if(GPIO.input(button_pin) == 0): #Buzzer ein GPIO.output(buzzer_pin, GPIO.HIGH) else: #Buzzer aus GPIO.output(buzzer_pin, GPIO.LOW)
except KeyboardInterrupt:
GPIO.cleanup()
sudo python button_buzzer.py
cd /home/pi/Desktop/Joy-Pi/
Page 17
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 17
Joy-Pi
5.3 LEKTION 3: WIE EIN RELAIS FUNKTIONIERT UND WIE MAN ES STEUERT
Nachdem wir jetzt alles Nöge über den Buzzer wissen, ist es Zeit für die nächste Lekon. Nun lernen wir, wie das Relais zu verwenden ist, welche Funkon das Relais hat und wie man es steuert.
Ein Relais ist vereinfacht ein Schalter, den (unteranderem) mit GPIO-Pins ein– und ausschalten kann. Relais werden verwendet, um eine Schaltung durch ein separates Niederleistungssignal zu steuern, oder wenn mehrere Schaltungen durch ein Signal gesteuert werden müssen. In unserem Beispiel zeigen wir, wie ein GPIO-Signal gesendet wird, um das Relais zu schließen, um eine benutzerdenierte Schaltung zu
akvieren und wie man ein weiteres Signal sendet, um das Relais zu önen und die Schaltung zu
deakvieren.
Das Relais bendet sich im mileren, unteren Teil der Plane, direkt neben der Taster-Matrix. Es hat drei Anschlüsse, von denen wir 2 in diesem Beispiel benutzen werden. NCsteht für normally closed“, „NO steht für normally openund comsteht für common“. „commonsteht in dem Fall für die
gemeinsame Masse.
Wenn ein Stromkreis an NCund COMangschlossen wird, ist der Stromkreis geschlossen, wenn der Steuerstromkreis spannungslos ist (GPIO.LOW). Wird der Steuerstromkreis unter Spannung gesetzt (GPIO.HIGH), önet das Relais die Verbindung im Arbeitsstromkreis und der Stromuss wird unterbrochen. Bei der Nutzung von NOund COMverhält es sich genau umgekehrt. Ist der Steuerstromkreis spannungslos (GPIO.LOW), ist das Relais geönet und der Arbeitsstromkreis unterbrochen. Wird der Steuerstrom mit Spannung versorgt (GPIO.HIGH), schließt das Relais den Arbeitsstromkreis und der Strom kann ießen.
Achtung! Es ist sehr wichg, nicht zu versuchen, Hochspannungsgeräte an das Relais anzu­schließen (z.B. Tischlampe, Kaeemaschine usw.). Dies könnte zu Stromschlägen und schweren Verletzungen führen.
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 18
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 18
Joy-Pi
Jetzt, da wir wissen, was ein Relais ist und wie es funkoniert, werfen wir einen Blick auf den Code:
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
#!/usr/bin/python
import RPi.GPIO as GPIO import time
# definiere relais pin
relay_pin = 40
# Board Modus GPIO.BOARD
GPIO.setmode(GPIO.BOARD)
# relay_pin als Ausgang
GPIO.setup(relay_pin, GPIO.OUT)
# Oeffne Relais
GPIO.output(relay_pin, GPIO.LOW)
# warte eine halbe Sekunde
time.sleep(0.5)
# schliesse Relais
GPIO.output(relay_pin, GPIO.HIGH) GPIO.cleanup()
sudo python relay.py
cd /home/pi/Desktop/Joy-Pi/
Page 19
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 19
Joy-Pi
5.4 LEKTION 4: SENDEN EINES VIBRATIONSSIGNALS
Haben Sie sich schon einmal gefragt, wie Ihr Telefon vibriert, wenn Sie jemand anru oder wenn Sie eine Nachricht erhalten? Wir haben genau das gleiche Modul in unserem Joy-Pi verbaut und nun werden Sie lernen, wie man es verwendet.
Das Vibraonsmodul bendet sich auf der rechten Seite der LED-Matrix und unterhalb der Segment-LED. Wenn es eingeschaltet ist, ist es schwierig zu erkennen, woher die Vibraon kommt, da es sich anfühlt, als vibriere das ganze Joy-Pi Board.
Das Vibraonsmodul verwendet ein GPIO.OUTPUT-Signal, genau wie der Buzzer und andere Module zuvor. Durch Senden eines Ausgangssignals vibriert das Vibraonsmodul, durch Stoppen des Signals mit GPIO.LOW hört die Vibraon auf.
Mit verschiedenen me.sleep() Intervallen kann man die Dauer der Vibraon regeln. Versuchen Sie es selbst und schauen Sie, wie Sie das Beispiel erweitern können.
Für dieses Beispiel müssen Sie zwischen den Modulen wechseln. Stellen Sie Schalter Nummer 1 der rechten Schalteinheit auf ON. Alle anderen Schalter sollten auf OFF stehen.
Page 20
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 20
Joy-Pi
Beispielcode Vibraonsmodul:
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
#!/usr/bin/python
import RPi.GPIO as GPIO import time
# definieren des Vibrationspins
vibration_pin = 13
# setze Boardmodus zu GPIO.BOARD
GPIO.setmode(GPIO.BOARD)
# lege Vibrationspin als Ausgang fest
GPIO.setup(vibration_pin, GPIO.OUT)
# schalte Vibration ein
GPIO.output(vibration_pin, GPIO.HIGH)
# warte eine Sekunde
time.sleep(1)
# schalte Vibration aus
GPIO.output(vibration_pin, GPIO.LOW)
GPIO.cleanup()
sudo python vibration.py
cd /home/pi/Desktop/Joy-Pi/
Page 21
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 21
Joy-Pi
5.5 LEKTION 5: GERÄUSCHE MIT DEM SCHALLSENSOR ERKENNEN
In dieser Lekon lernen wir, wie man über den Schallsensor Eingaben tägt, laute Geräusche erkennt und entsprechend reagiert. So können Sie Ihr eigenes Alarmsystem auauen, das laute Geräusche erkennt oder eine LED durch Klatschen einschalten!
Der aus 2 Teilen aufgebaute Schallsensor besteht aus einem blauen Potenometer, das für die Regulierung der Empndlichkeit zuständig ist, und dem Sensor selbst, der Geräusche erkennt. Der Schallsensor ist gut am blauen Potenometer zu erkennen und der Sensor selbst bendet sich rechts unter dem Buzzer.
Mit Hilfe des Potenometers können wir die Empndlichkeit des Sensors regulieren. Damit unser Skript funkoniert, müssen wir zuerst lernen, wie man die Empndlichkeit steuert. Um die Empndlichkeit zu regulieren, müssen Sie die kleine Schraube am Potenometer mit einem Schraubendreher nach links oder rechts drehen. Wenn sie gegen den Uhrzeigersinn drehen, steigt die Empndlichkeit mit dem Uhrzeigersinn verringert sich diese. Der beste Weg die Empndlichkeit zu testen
ist das Skript auszuführen. Klatschen Sie in die Hände und schauen Sie, ob das Gerät ein Signal empfängt.
Wenn kein Signal empfangen wird bedeutet dies, dass die Empndlichkeit des Sensors nicht hoch genug eingestellt ist. Dies können Sie durch drehen des Potenometers einfach beheben.
#!/usr/bin/python
import RPi.GPIO as GPIO import time
# sound_pin wird definiert
sound_pin = 18
# GPIO mode wird auf GPIO.BOARD gesetzt
GPIO.setmode(GPIO.BOARD)
# sound_pin wird als Eingang festgelegt
GPIO.setup(sound_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
try:
while True: # ueberpruefe ob ein Geraeusch erkannt wird if(GPIO.input(sound_pin)==GPIO.LOW): print('Sound erkannt') time.sleep(0.1)
except KeyboardInterrupt:
# Strg+c beendet das Programm GPIO.cleanup()
Page 22
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 22
Joy-Pi
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
Wir denieren zuerst unseren Pin, GPIO18. Dann setzen wir eine while-Schleife, um dieses Skript
dauerha laufen zu lassen. Wir prüfen, ob wir vom Schallsensor eine Eingabe erhalten haben, die anzeigt,
dass laute Geräusche erkannt wurden und dann drucken wir "Sound Detected".
Wenn Strg + C gedrückt wird, wird das Programm beendet.
5.6 LEKTION 6: ERKENNEN DER HELLIGKEIT MIT DEM LICHTSENSOR
Der Lichtsensor ist einer unserer Lieblinge. Er ist in vielen Projekten und Situaonen äußerst nützlich, z. B. bei Lampen, die automasch angehen, sobald es dunkel wird. Mit dem Lichtsensor kann man erkennen, wie hell die Moduloberäche ist.
Der Lichtsensor ist schwer zu erkennen, da er aus sehr kleinen Teilen besteht. Der Sensor liegt links neben dem Buzzer. Wenn Sie ihn mit Ihrem Finger verdecken, sollte die Ausgabe des Lichtsensors nahe null gehen, da ihn kein Licht mehr erreichen kann.
sudo python sound.py
cd /home/pi/Desktop/Joy-Pi/
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 23
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 23
Joy-Pi
Nun ist es Zeit, den Sensor zu testen und zu sehen, wie er funkoniert. Jedoch ist der Lichtsensor ein wenig anders, als andere Sensoren, da er mit I2C funkoniert und nicht mit den normalen GPIOs, wie Sie es in den Lekonen zuvor gelernt haben.
In diesem Skript wird eine Funkon verwendet, um mit dem Lichtsensor zu "kommunizieren" und die ge­wünschte Ausgabe mit der Helligkeit zu erhalten. Je höher die ausgegebene Zahl ist, desto heller ist die Umgebung.
Beispielcode:
#!/usr/bin/python # -*- coding: utf-8 -*- # Author: Matt Hawkins
# Author's Git: https://bitbucket.org/MattHawkinsUK/
# Author's website: https://www.raspberrypi-spy.co.uk
import RPi.GPIO as GPIO import smbus import time
if(GPIO.RPI_REVISION == 1):
bus = smbus.SMBus(0)
else:
bus = smbus.SMBus(1)
class LightSensor():
def __init__(self):
# Definiere Konstante vom Datenblatt
self.DEVICE = 0x5c # Standart I2C Geräteadresse
self.POWER_DOWN = 0x00 # Kein aktiver zustand self.POWER_ON = 0x01 # Betriebsbereit self.RESET = 0x07 # Reset des Data registers
# Starte Messungen ab 4 Lux. self.CONTINUOUS_LOW_RES_MODE = 0x13 # Starte Messungen ab 1 Lux. self.CONTINUOUS_HIGH_RES_MODE_1 = 0x10 # Starte Messungen ab 0.5 Lux. self.CONTINUOUS_HIGH_RES_MODE_2 = 0x11 # Starte Messungen ab 1 Lux.
# Nach messung wird Gerät in einen inaktiven Zustand gesetzt.
self.ONE_TIME_HIGH_RES_MODE_1 = 0x20 # Starte Messungen ab 0.5 Lux. # Nach messung wird Gerät in einen inaktiven Zustand gesetzt. self.ONE_TIME_HIGH_RES_MODE_2 = 0x21 # Starte Messungen ab 4 Lux. # Nach messung wird Gerät in einen inaktiven Zustand gesetzt. self.ONE_TIME_LOW_RES_MODE = 0x23
Page 24
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 24
Joy-Pi
Beispielcode fortgeführt:
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
sudo python light_sensor.py
cd /home/pi/Desktop/Joy-Pi/
def convertToNumber(self, data):
# Einfache Funktion um 2 Bytes Daten # in eine Dezimalzahl umzuwandeln return ((data[1] + (256 * data[0])) / 1.2)
def readLight(self):
data = bus.read_i2c_block_data(self.DEVICE,self.ONE_TIME_HIGH_RES_MODE_1) return self.convertToNumber(data)
def main():
sensor = LightSensor() try: while True: print "Light Level : " + str(sensor.readLight()) + " lx" time.sleep(0.5) except KeyboardInterrupt: pass
if __name__ == "__main__":
main()
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 25
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 25
Joy-Pi
5.7 LEKTION 7: ERKENNEN DER TEMPERATUR UND LUFTFEUCHTIGKEIT
Der DHT11 ist ein sehr interessanter Sensor, da er nicht nur eine Funkon hat, sondern zwei! Er enthält sowohl einen Feuchgkeitssensor als auch einen Temperatursensor, welche beide sehr genau sind. Ideal für jedes Weerstaonsprojekt, oder, wenn Sie die Temperatur und Lufeuchgkeit im Raum überprüfen möchten!
Der DHT11-Sensor ist sehr einfach zu erkennen. Ein kleiner blauer Sensor mit vielen kleinen Löchern. Er liegt rechts neben dem Relais und oberhalb des Berührungssensors. Als besonders zugänglich haben sich die Adafruit-DHT Libraries erwiesen, die die Firma Adafruit unter hps://github.com/adafruit/
Adafruit_Python_DHT unter der [BSD-Lizenz] veröentlicht hat.
Die Bibliothek wird verwendet, um Temperatur und Feuchgkeit als Werte auszugeben, ohne dabei komplizierte, mathemasche Berechnungen durchführen zu müssen.
#!/usr/bin/python # Copyright (c) 2014 Adafruit Industries # Author: Tony DiCola
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions:
import sys import Adafruit_DHT
sensor = 11 # Festlegung des Sensortyps pin = 4 # Festlegung der Pin Nummer
# Versuche Daten vom Sensor zu lesen. Die read_retry Methode versucht bis zu # 15 mal Daten zu empfangen (Wartet 2 Sekunden zwischen jedem Versuch).
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
# Die untere Zeile unkommentieren um die Temperatur in Fahrenheit anzeigen zu lassen.
# temperature = temperature * 9/5.0 + 32
# Manchmal kann der Sensor nicht ausgelesen werden. # Das Ergebnis wird dann Null sein. # Sollten beide Ergebnisse Null sein wird in die # Konsole "Fehler beim Lesen. Versuchen Sie es Erneut!" ausgegeben.
if humidity is not None and temperature is not None:
print('Temp={0:0.1f}* Humidity={1:0.1f}%'.format(temperature, humidity))
else:
print('Fehler beim Lesen. Versuchen sie es Erneut!')
sys.exit(1)
Page 26
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 26
Joy-Pi
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst::
6.8 LEKTION 8: BEWEGUNGEN ERKENNEN
Der Bewegungssensor ist einer der nützlichsten und am häugsten benutzten Sensoren. Man kann mit ihm zum Beispiel eine Alarmanlage bauen. Wenn der Sensor eine Bewegung erkennt, kann er ein Signal an den Buzzer senden, der dann einen lauten Alarmton von sich gibt.
Der Bewegungssensor bendet sich direkt unter dem Schallsensor und wird von einer kleinen, transparenten Kappe abgedeckt. Die Kappe hil dem Sensor mehr Bewegungen zu erkennen, indem sie das Infrarotlicht der Umgebung bricht. Die Empndlichkeit des Bewegungssensors wird, wie die des Schallsensors, mit einem Potenometer geregelt. Dieser bendet sich unterhalb des Potenometers des Schallsensors, ist jedoch deutlich kleiner. Mit Hilfe eines Kreuzschraubendrehers können Sie einstellen, über welche Enernun- gen der Bewegungs­sensor auslösen soll. Wenn Sie gegen den Uhrzeigersinn drehen, steigt die Emp- ndlichkeit, mit dem Uhrzeigersinn verringert sie sich.
sudo python dht11.py
cd /home/pi/Desktop/Joy-Pi/
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 27
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 27
Joy-Pi
Der Bewegungssensor wird durch die GPIO-Pins gesteuert. Wenn eine Bewegung erkannt wird, wird der Bewegungssensor ein Signal senden. Dieses hält einige Zeit an und hört dann wieder auf, bis der Sensor die nächste Bewegung erkennt.
Probieren Sie das Beispiel aus und versuchen Sie es nach Ihren Vorstellungen zu erweitern.
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
#!/usr/bin/python # -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import time #Importieren der Bibliotheken
motion_pin = 16 #Den Pin des Bewegungssensors einer Variable zuweisen.
GPIO.setmode(GPIO.BOARD) #Die GPIO Boardkonfiguration benutzen. GPIO.setup(motion_pin, GPIO.IN) #Der Pin der Deklarierten Variable wird als Input gesetzt.
try: # Beginn einer Schleife
while True: if(GPIO.input(motion_pin) == 0): # Wenn der Sensor Input = 0 ist print "Keine Bewegung ..." # Wird der print Befehl ausgeführt elif(GPIO.input(motion_pin) == 1): # Wenn der Sensor Input = 1 ist print "Bewegung Erkannt!" # Wird der print Befehl ausgeführt time.sleep(0.1) # 0,1 Sekunde Warten
except KeyboardInterrupt:
GPIO.cleanup() # Gibt GPIO Ports wieder frei.
sudo python motion.py
cd /home/pi/Desktop/Joy-Pi/
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 28
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 28
Joy-Pi
5.9 LEKTION 9: ENTFERNUNGEN MIT DEM ULTRASCHALLSENSOR MESSEN
Nun werden wir lernen, wie wir den Ultraschallsensor verwenden, um Enernungen zu messen und auf dem Joy-Pi-Bildschirm auszugeben. Autos verwenden übrigens die gleiche Methode, um Abstände zu messen.
Der Ultraschallsensor bendet sich rechts unten auf der Joy-Pi-Plane, direkt über der Schrimotor– und der Servo-Schnistelle. Er ist leicht an den zwei großen Kreisen zu erkennen. Wir werden unsere Hände über dem Enernungssensor bewegen, um die Enernung zwischen unseren Händen und dem Joy-Pi zu messen.
Der Abstandssensor arbeitet mit GPIO INPUT, doch es ist etwas anders als das, was wir in unseren vorherigen Lekonen verwendet haben. Der Sensor benögt ein gewisses Intervall, um in der Lage zu
sein, die Enernung auf genaue Art und Weise zu erfassen. Er sendet ein Ultraschallsignal und empfängt
mit einem eingebauten Sensor das Echo, das von einem Hindernis zurückgeworfen wird. Aus dem zeitlichen Abstand zwischen dem Senden des Signals und dem Empfangen des Echos, wird die Distanz berechnet.
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 29
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 29
Joy-Pi
Beispielcode Ultraschallsensor:
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
#!/usr/bin/python # -*- coding: utf-8 -*- # Author : www.modmypi.com # Link: https://www.modmypi.com/blog/hc-sr04-ultrasonic-range-sensor-on-the-raspberry-pi
import RPi.GPIO as GPIO import time
GPIO.setmode(GPIO.BOARD) # Setze die GPIO Boardkonfiguration ein.
TRIG = 36 # Variablendeklaration ECHO = 32 # Variablendeklaration
print "Entfernung wird ermittelt." # Ausgabe von Text in der Konsole
GPIO.setup(TRIG,GPIO.OUT) # Variable TRIG als Output festlegen. GPIO.setup(ECHO,GPIO.IN) # Variable ECHO als Input festlegen.
GPIO.output(TRIG, False)
print "Warte auf den Sensor."
time.sleep(2) # 2 Sekunden Wartezeit.
GPIO.output(TRIG, True) # Sendet ein Ultraschallsignal time.sleep(0.00001) # Wartet 0,00001 Sekunden GPIO.output(TRIG, False) # Beendet das senden des Ultraschallsignals
while GPIO.input(ECHO)==0:
pulse_start = time.time()
while GPIO.input(ECHO)==1:
pulse_end = time.time()
pulse_duration = pulse_end - pulse_start # Berechnung für die Dauer Des Pulses
distance = pulse_duration * 17150 # Berechnung zur Bestimmung der Entfernung.
distance = round(distance, 2) # Ergebnis wird auf 2 Nachkommastellen gerundet.
print "Distance:",distance,"cm" # Konsolenausgabe der Distanz in cm.
GPIO.cleanup() # Gibt GPIO Ports wieder frei.
sudo python distance.py
cd /home/pi/Desktop/Joy-Pi/
Page 30
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 30
Joy-Pi
6.10 LEKTION 10: STEUERN DES LCDS
Mit dem Joy-Pi können Sie Daten auf dem LCD anzeigen lassen, die Sie mit Ihren Sensoren sammeln und aktualisieren sie in Echtzeit, abhängig von den Änderungen, die die Module durchlaufen. Zum Beispiel in Verbindung mit dem Temperatursensor - lassen Sie immer die aktuelle Temperatur und Lufeuchgkeit auf dem LCD anzeigen.
Der LCD-Bildschirm nimmt einen großen Teil des Joy-Pi-Boards ein - er bendet sich oben in der Mie des Joy-Pis, rechts von der GPIO LED-Anzeige. Sobald das Demo-Skript und die Beispiele ausgeführt werden, schaltet sich das Display ein. Dank der integrierten Hintergrundbeleuchtung kann man auch in völliger Dunkelheit Daten von dem Display ablesen.
Wie bereits der Schall– und der Bewegungssensor, hat auch das LCD ein zugehöriges Potenometer. Mit diesem Potenometer lässt sich der Kontrast des Displays einstellen. Wenn Sie gegen den Uhrzeigersinn drehen wird der Kontrast höher und mit dem Uhrzeigersinn schwächer.
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 31
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 31
Joy-Pi
Das LCD, sowie einige andere Sensoren funkonieren nicht mit der GPIO-Technologie. Deshalb wird das Bussystem I2Cverwendet, das eignet sich besonders gut, um mehrere integrierte Schaltungen kommunizieren zu lassen. Das LCD hat die Adresse 0x21, indem wir eine Verbindung zu dieser I2C­Adresse herstellen, können Befehle wie z. B. schreiben von Text, Einschalten der Hintergrundbeleuchtung des LCDs, Akvieren des Cursors usw. gesendet werden.
Zur Steuerung des LCDs wird die Adafruit_CharLCDBackpack Bibliothek verwendet.
Beispielcode LCD:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time import Adafruit_CharLCD as LCD
# Definiere LCD Zeilen und Spaltenanzahl.
lcd_columns = 16 lcd_rows = 2
# Festlegen des LCDs und der I2C Adresse in die Variable LCD
lcd = LCD.Adafruit_CharLCDBackpack(address=0x21)
try:
# Hintergrundbeleuchtung einschalten
lcd.set_backlight(0)
# Zwei Worte mit Zeilenumbruch werden ausgegeben lcd.message('Hallo\nWelt!')
# 5 Sekunden warten time.sleep(5.0)
# Cursor anzeigen lassen. lcd.clear() lcd.show_cursor(True) lcd.message('Show cursor')
time.sleep(5.0)
# Cursor Blinken Lassen.
lcd.clear()
lcd.blink(True) lcd.message('Blink cursor')
time.sleep(5.0)
# Stoppen den blinkenden Cursors und Cursor ausblenden. lcd.show_cursor(False) lcd.blink(False)
Page 32
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 32
Joy-Pi
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
# Nachricht von Rechts/Links scrollen lassen. lcd.clear() message = 'Scroll' lcd.message(message) for i in range(lcd_columns-len(message)): time.sleep(0.5) lcd.move_right()
for i in range(lcd_columns-len(message)):
time.sleep(0.5) lcd.move_left()
# HIntergrundbeleuchtung an und ausschalten. lcd.clear() lcd.message('Flash backlight\nin 5 seconds...') time.sleep(5.0) # Hintergrundbeleuchtung ausschalten. lcd.set_backlight(1) time.sleep(2.0) # Nachricht ändern. lcd.clear() lcd.message('Goodbye!') # Hintergrundbeleuchtung einschalten.
lcd.set_backlight(0)
# Hintergrundbeleuchtung ausschalten. time.sleep(2.0) lcd.clear() lcd.set_backlight(1)
except KeyboardInterrupt:
# LCD ausschalten. lcd.clear() lcd.set_backlight(1)
sudo python lcd.py
cd /home/pi/Desktop/Joy-Pi/
Beispielcode LCD fortgeführt:
Page 33
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 33
Joy-Pi
5.11 LEKTION 11: LESEN UND SCHREIBEN VON RFID-KARTEN
In dieser Lekon werden Sie lernen, wie man das RFID-Modul steuert. Das RFID-Modul ist ein sehr interessantes und nützliches Modul. Es wird weltweit in einer Vielzahl von Lösungen eingesetzt wie z.B.: Intelligente Türschlösser, Mitarbeiterausweise, Visitenkarten und sogar Hundehalsbänder.
Das RFID-Modul bendet sich direkt unter dem Raspberry Pi und sieht wie ein kleines Wi-Symbol aus. Dieses Symbol bedeutet drahtlose Konnekvität. Um es zu benutzen, müssen wir den Chip, oder die Kar­te, nehmen, die mit dem Joy-Pi geliefert wird und sie über den Joy-Pi RFID-Chip-Bereich halten. Es muss nah genug für unser Skript sein, damit es erkannt wird. 2-4cm sollten nah genug sein. Probieren sie es einfach aus!
Für das RFID RC522 Shield verwenden wir den SPI Bus. Damit der Kernel beim Starten geladen wird, bear-
beiten wir die cong.txt Datei indem wir folgenden Befehl eingeben:
Folgender Inhalt wird an das Ende der Datei hinzugefügt: Gespeichert und beendet wird mit STRG+O, STRG+X. Danach akvieren Sie noch SPI:
Unter Interfacing Opons“ > „SPIakvieren und anschließend den Raspberry Pi neu starten.
sudo nano /boot/config.txt
sudo raspi-config
device_tree_param=spi=on dtoverlay=spi-bcm2708
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 34
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 34
Joy-Pi
Um in den Ordner für die Scripte des RFID Lesers zu gelangen geben Sie folgenden Befehl ein:
Wenn Sie nun die RFID Karte oder den Chip beschreiben wollen benutzen Sie folgenden Befehl:
Um die Dateien zu bearbeiten die Sie auf den Chip oder die Karte speichern, müssen sie den Quellcode bearbeiten:
Um die Dateien die gespeichert werden zu verändern müssen sie nun die Zahlen in der eckigen Klammer verändern, allerdings können diese Zahlen nicht kleiner als 0 und nicht größer als 255 sein.
Wenn Sie anschließend die Zahlenfolge auslesen möchten benutzen Sie den folgenden Befehl:
Wenn Sie nun die Karte oder den Chip auf den Leser legen wird ihnen die Zahlenfolge angezeigt:
Die Beispielcodes benden sich auf den nächsten Seiten
cd /home/pi/Desktop/Joy-Pi/MFRC522-python
sudo python Write.py
sudo python Read.py
Page 35
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 35
Joy-Pi
Beispielcode RFID-Read:
#!/usr/bin/env python # -*- coding: utf8 -*- # Copyright 2014,2018 Mario Gomez <mario.gomez@teubi.co>
import RPi.GPIO as GPIO import MFRC522 import signal
continue_reading = True
# Funktion um cleanup Funktionen durchzuführen wenn das Script abgebrochen wird.
def end_read(signal,frame):
global continue_reading
print "Ctrl+C captured, ending read."
continue_reading = False GPIO.cleanup()
signal.signal(signal.SIGINT, end_read)
# Erstelle ein objekt aus der Klasse MFRC522
MIFAREReader = MFRC522.MFRC522()
# Wilkommensnachricht
print "Willkommen beim MFRC522 Lese Beispiel." print "Druecke STRG+C zum Beenden."
# Diese Schleife Sucht dauerhaft nach Chips oder Karten. Wenn eine nah ist bezieht er die UID und identifiziert sich.
while continue_reading:
# Nach Chips und Karten scannen
(status,TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL) # Wenn eine Karte gefunden wurde if status == MIFAREReader.MI_OK: print "Card detected"
# Beziehe UID der Karte (status,uid) = MIFAREReader.MFRC522_Anticoll()
# Wenn UID vorhanden fortfahren if status == MIFAREReader.MI_OK: # Print UID print "Card read UID: %s,%s,%s,%s" % (uid[0], uid[1], uid[2], uid[3]) # Standard Schlüssel für Authentifizierungen key = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF] # Select the scanned tag
MIFAREReader.MFRC522_SelectTag(uid)
# Authentifizieren status = MIFAREReader.MFRC522_Auth(MIFAREReader.PICC_AUTHENT1A, 8, key, uid) # Prüfen ob authentifiziert if status == MIFAREReader.MI_OK: MIFAREReader.MFRC522_Read(8) MIFAREReader.MFRC522_StopCrypto1() else: print "Authentication error"
Page 36
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 36
Joy-Pi
Beispielcode RFID-Write:
#!/usr/bin/env python # -*- coding: utf8 -*-
import RPi.GPIO as GPIO import MFRC522
import signal
continue_reading = True
# Funktion um cleanup Funktionen durchzuführen wenn das Script abgebrochen wird.
def end_read(signal,frame):
global continue_reading print "Ctrl+C captured, ending read." continue_reading = False GPIO.cleanup()
signal.signal(signal.SIGINT, end_read)
# Erstelle ein Objekt aus der Klasse MFRC522
MIFAREReader = MFRC522.MFRC522()
# Diese Schleife Sucht dauerhaft nach Chips oder Karten. Wenn eine nah ist bezieht er die UID und identifiziert sich.
while continue_reading:
# SUcht Karten (status,TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL)
# Wenn Karte gefunden if status == MIFAREReader.MI_OK: print "Card detected"
# UID der Karte erhalten (status,uid) = MIFAREReader.MFRC522_Anticoll()
# Wenn UID erhalten, fortfahren
if status == MIFAREReader.MI_OK:
# UID in Konsole ausgeben print "Card read UID: %s,%s,%s,%s" % (uid[0], uid[1], uid[2], uid[3])
# Standard Schlüssel für Authentifizierungen key = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]
Page 37
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 37
Joy-Pi
Beispielcode RFID-Write fortgeführt:
MIFAREReader.MFRC522_SelectTag(uid)
# Authentifizieren status = MIFAREReader.MFRC522_Auth(MIFAREReader.PICC_AUTHENT1A, 8, key, uid)
print "\n"
# Prüfen ob authentifiziert if status == MIFAREReader.MI_OK:
# Variablen der Werte die auf der Karte gespeichert werden sollen. data = [99, 11, 55, 66, 44, 111, 222, 210, 125, 153, 136, 199, 144, 177, 166,
188]
for x in range(0,16): data.append(0xFF)
print "Sector 8 looked like this:" # Block 8 lesen MIFAREReader.MFRC522_Read(8)
print "\n"
print "Sector 8 will now be filled with 0xFF:" # Dateien Schreiben MIFAREReader.MFRC522_Write(8, data) print "\n"
print "It now looks like this:" # Überprüfen ob beschrieben wurde MIFAREReader.MFRC522_Read(8) print "\n"
MIFAREReader.MFRC522_StopCrypto1()
# Sicherstellen das, das Kartenlesen eingestellt wird. continue_reading = False
else:
print "Authentification error"
Page 38
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 38
Joy-Pi
5.12 LEKTION 12: SCHRITTMOTOREN VERWENDEN
Der Schrimotor ist ein unabhängiges Modul, welches Sie mit dem Board verbinden müssen.
Verbinden Sie den Schrimotor einfach am folgenden Anschluss des Joy-Pi-Boards:
Der Schrimotor kann sich während der Verwendung erwärmen. Dies ist technisch bedingt und nicht ungewöhnlich.
Der Schrimotor ist mit 4 GPIO-Pins verbunden, welche schnell hintereinander eingeschaltet werden. Dies bewirkt, dass der Schrimotor vorwärts schiebtund einen Schri macht. Mit der Funkon turnSteps kann eine beliebige Anzahl von Schrien ausgeführt werden. Die Funkon turnDegrees lässt den Motor um einen besmmten besmmte Winkel drehen.
Den Beispielcode können Sie auf den nächsten drei Seiten nden.
Für dieses Beispiel müssen Sie zwischen den Modulen wechseln. Stellen Sie die Schalter Num-
mer 3, 4, 5 und 6 der rechten Schalteinheit auf ON. Alle anderen Schalter sollten auf OFF stehen.
Page 39
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 39
Joy-Pi
Beispielcode Schrimotor:
#!/usr/bin/python # -*- coding: utf-8 -*- # Author : Original author ludwigschuster # Original Author Github: https://github.com/ludwigschuster/RasPi-GPIO-Stepmotor
import time import RPi.GPIO as GPIO import math
class Stepmotor:
def __init__(self):
# GPIO modus Festlegen GPIO.setmode(GPIO.BOARD) # Das Sind die Pins Ihres RasperryPis die benutzt werden. self.pin_A = 29 self.pin_B = 31 self.pin_C = 33 self.pin_D = 35 self.interval = 0.010
# Pins als Output Deklarieren GPIO.setup(self.pin_A,GPIO.OUT) GPIO.setup(self.pin_B,GPIO.OUT) GPIO.setup(self.pin_C,GPIO.OUT)
GPIO.setup(self.pin_D,GPIO.OUT)
GPIO.output(self.pin_A, False) GPIO.output(self.pin_B, False) GPIO.output(self.pin_C, False) GPIO.output(self.pin_D, False)
def Step1(self):
GPIO.output(self.pin_D, True) time.sleep(self.interval) GPIO.output(self.pin_D, False)
def Step2(self):
GPIO.output(self.pin_D, True) GPIO.output(self.pin_C, True)
time.sleep(self.interval)
GPIO.output(self.pin_D, False) GPIO.output(self.pin_C, False)
def Step3(self):
GPIO.output(self.pin_C, True) time.sleep(self.interval) GPIO.output(self.pin_C, False)
Page 40
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 40
Joy-Pi
Beispielcode Schrimotor fortgeführt:
def Step4(self):
GPIO.output(self.pin_B, True) GPIO.output(self.pin_C, True) time.sleep(self.interval) GPIO.output(self.pin_B, False) GPIO.output(self.pin_C, False)
def Step5(self):
GPIO.output(self.pin_B, True) time.sleep(self.interval) GPIO.output(self.pin_B, False)
def Step6(self):
GPIO.output(self.pin_A, True) GPIO.output(self.pin_B, True) time.sleep(self.interval) GPIO.output(self.pin_A, False) GPIO.output(self.pin_B, False)
def Step7(self):
GPIO.output(self.pin_A, True) time.sleep(self.interval) GPIO.output(self.pin_A, False)
def Step8(self):
GPIO.output(self.pin_D, True) GPIO.output(self.pin_A, True) time.sleep(self.interval) GPIO.output(self.pin_D, False) GPIO.output(self.pin_A, False)
def turn(self,count): for i in range (int(count)): self.Step1()
self.Step2()
self.Step3() self.Step4() self.Step5() self.Step6() self.Step7() self.Step8()
Page 41
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 41
Joy-Pi
Beispielcode Schrimotor fortgeführt:
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
sudo python stepmotor.py
cd /home/pi/Desktop/Joy-Pi/
def close(self): # Die GPIO Pins für andere Aktivitäten freigeben. GPIO.cleanup()
def turnSteps(self, count): # Bewegen um n schritte # (n wird von Ihnen festgelegt.) for i in range (count):
self.turn(1)
def turnDegrees(self, count): # Bewegen um n Grad (Kleine Werte können zu Ungenauigkeit führen.) # (Gradnummer die gedreht werden soll angeben.) self.turn(round(count*512/360,0))
def turnDistance(self, dist, rad): self.turn(round(512*dist/(2*math.pi*rad),0))
def main():
print("Bewegung gestartet.") motor = Stepmotor() print("Ein Schritt") motor.turnSteps(1)
time.sleep(0.5)
print("20 Schritte") motor.turnSteps(20) time.sleep(0.5) print("Viertel Umdrehung") motor.turnDegrees(90) print("Bewegung gestoppt.") motor.close()
if __name__ == "__main__":
main()
Page 42
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 42
Joy-Pi
5.13 LEKTION 13: STEUERUNG VON SERVOMOTOREN
Mit Hilfe des Servomotors lassen sich Geräte mechanisch steuern und Teile bewegen. So können
beispielsweise intelligente Abfalleimer, eine Schachtel mit intelligenter, önender/schließender Tür und viele andere interessante Projekte erstellt werden.
Der Joy-Pi besitzt zwei Servo-Schnistellen, die beide zur Steuerung von Servomotoren genutzt werden können. In diesem Tutorial verwenden wir die Schnistelle Nummer zwei, die als "Servo2" markiert ist. Sie können natürlich auch die andere Servo-Schnistelle verwenden, dazu müssen Sie jedoch das Skript auf die richgen GPIOs anpassen.
Der Servomotor benögt drei Pins: Posiv, Negav und den Daten-Pin. Der posive Pin ist das rote Kabel, der negave Pin das schwarze Kabel (auch Masse genannt) und das Datenkabel ist Gelb.
Für dieses Beispiel müssen Sie zwischen den Modulen wechseln. Stellen Sie die Schalter Num­mer 7 und 8 der rechten Schalteinheit auf ON. Alle anderen Schalter sollten auf OFF stehen.
Page 43
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 43
Joy-Pi
Schauen Sie sich den Beispielcode an, um ihn besser zu verstehen:
Der Servo benutzt die GPIO.Board Pin Nummer 22. Jedes Mal wird das Skript die Richtung vom Servomotor festlegen, um zu drehen. Wir können posive Gradzahlen verwenden, um links herumzudre­hen und negave, um rechts herumzudrehen. Verändern Sie einfach die Gradzahlen und schauen Sie, wie sich die Drehung des Motors verändert.
Den Beispielcode können Sie auf der nächsten Seite nden.
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
Kabel Pin
Rot Miler Pin von Servo2
Schwarz Rechter Pin von Servo2
Bunt Linker Pin von Servo2
sudo python servo.py
cd /home/pi/Desktop/Joy-Pi/
Page 44
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 44
Joy-Pi
#!/usr/bin/python # -*- coding: utf-8 -*- # Author : Original author WindVoiceVox # Original Author Github: https://github.com/WindVoiceVox/Raspi_SG90
import RPi.GPIO as GPIO import time import sys
class sg90:
def __init__( self, pin, direction ): GPIO.setmode( GPIO.BOARD ) GPIO.setup( pin, GPIO.OUT )
self.pin = int( pin )
self.direction = int( direction ) self.servo = GPIO.PWM( self.pin, 50 ) self.servo.start(0.0) def cleanup( self ): #Funktion zum Stoppen und GPIO Pins Freigeben
self.servo.ChangeDutyCycle(self._henkan(0)) time.sleep(0.3) self.servo.stop() GPIO.cleanup()
def currentdirection( self ): #Funktion die die Momentane Position feststellt.
return self.direction
def _henkan( self, value ):
return 0.05 * value + 7.0
def setdirection( self, direction, speed ): #Funktion um die Richtung anzugeben
for d in range( self.direction, direction, int(speed) ): self.servo.ChangeDutyCycle( self._henkan( d ) ) self.direction = d time.sleep(0.1) self.servo.ChangeDutyCycle( self._henkan( direction ) ) self.direction = direction
def main():
servo_pin = 22 s = sg90(servo_pin,0) #Deklaration von Pin und Motor
try:
while True: print "Turn left ..." s.setdirection( 100, 10 ) #Links Herum drehen time.sleep(0.5) #0,5 Sekunden warten print "Turn right ..." s.setdirection( -100, -10 ) #Rechts Herum drehen time.sleep(0.5) #0,5 Sekunden warten except KeyboardInterrupt: s.cleanup()
if __name__ == "__main__":
main()
Beispielcode Servomotor:
Page 45
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 45
Joy-Pi
5.14 LEKTION 14: STEUERN DER 8X8 LED-MATRIX
Die LED-Matrix spielt in vielen blinkenden LED-Projekten eine wichge Rolle. Selbst wenn Sie es auf den ersten Blick nicht sehen, kann die LED-Matrix viel mehr als nur rot blinken. Sie kann verwendet werden, um Informaonen, Text, Emojis und sogar chinesische Schrizeichen anzuzeigen und sogar um ein Spiel wie Snake zu spielen.
Das LED-Matrixmodul ist ein großes quadrasches Modul, das sich auf der linken Seite der Segment-LED und direkt unter dem LCD bendet. Es kann leicht durch die kleinen weißen Punkte, welche die LEDs sind, erkannt werden.
In diesem Beispiel wird ein kurzer Text auf der LED-Matrix angezeigt.
Im Skript wird eine Zeichenfolge mit einer Nachricht erstellt und mit der Funkon show_message(), auf dem Matrix-Display angezeigt.
Sie können Eigenschaen, wie z. B. Verzögerungen steuern, die die Nachricht schneller oder langsamer machen. Zum Beispiel scroll_delay 0 wird ziemlich schnell sein, während eine Verzögerung von 0.1 den Nachrichtenuss etwas verlangsamt. Die Matrix LED verwendet im Gegensatz zu anderen Modulen eine SPI-Schnistelle, von der aus sie gesteuert werden kann. Probieren Sie das Beispiel aus und ändern Sie den Code, um zu sehen, was passiert.
Den Beispielcode können Sie auf der nächsten Seite nden
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 46
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 46
Joy-Pi
Beispielcode LED-Matrix:
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2017-18 Richard Hull and contributors # License: https://github.com/rm-hull/luma.led_matrix/blob/master/LICENSE.rst # Github link: https://github.com/rm-hull/luma.led_matrix/
# Alle benötigten Module importieren
import re import time from luma.led_matrix.device import max7219 from luma.core.interface.serial import spi, noop from luma.core.render import canvas from luma.core.virtual import viewport
from luma.core.legacy import text, show_message
from luma.core.legacy.font import proportional, CP437_FONT, TINY_FONT, SINCLAIR_FONT,
LCD_FONT
def main(cascaded, block_orientation, rotate):
# Matrix Gerät festlegen und erstellen. serial = spi(port=0, device=1, gpio=noop()) device = max7219(serial, cascaded=cascaded or 1, block_orientation=block_orientation, rotate=rotate or 0) # Matrix Initialisierung in der Konsole anzeigen print("[-] Matrix initialized")
# Hallo Welt in der Matrix anzeigen msg = "Hallo Welt"
# Ausgegebenen Text in der Konsole Anzeigen
print("[-] Printing: %s" % msg) show_message(device, msg, fill="white", font=proportional(CP437_FONT), scroll_delay=0.1)
if __name__ == "__main__":
# cascaded = Anzahl von MAX7219 LED Matrixen, standart=1 # block_orientation = choices 0, 90, -90, standart=0 # rotate = choices 0, 1, 2, 3, Rotate display 0=0°, 1=90°, 2=180°, 3=270°, standart=0
try: main(cascaded=1, block_orientation=90, rotate=0) except KeyboardInterrupt: pass
cd /home/pi/Desktop/Joy-Pi/
sudo python matrix_demo.py
Page 47
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 47
Joy-Pi
5.15 LEKTION 15: STEUERN DES 7-SEGMENT-DISPLAYS
Die Segment-LED ist ein sehr nützliches Display, wenn es um Zahlen geht. Es kann uns die Zeit zeigen oder zählen, wie o wir besmmte Dinge getan haben. Ihrer Fantasie sind keine grenzen gesetzt. Die Segment­Anzeige wird außerdem in vielen industriellen Lösungen, wie z.B. in Aufzügen, verwendet.
Die Segment-Anzeige bendet sich direkt über dem Vibraonssensor und neben der LED-Matrix. Wenn sie ausgeschaltet ist, sind 4 Achten zu erkennen. Sobald Sie das Segment-Display-Modul verwenden, wird die dunkle Farbe zu glänzendem, hellem Rot.
In unserem Beispiel demonstrieren wir eine Uhr. Wir werden die Uhrzeit- und Datumsmodule verwenden, um die Systemzeit des Raspberry Pi zu erhalten, welche wir mit dem Befehl segment.write_display() auf der Anzeige ausgeben. Der Befehl set_digit(), in Kombinaon mit den Nummer 0, 1, 2 und 3, legt die Posion auf dem Display fest, an der die Nummer gezeigt werden soll.
Da in diesem Beispiel die aktuelle Systemzeit abgerufen wird, ist es notwendig den Raspberry Pi zuerst auf die richge Zeitzone zu kongurieren. Önen Sie dazu ein Terminalfenster und geben Sie den folgenden Befehl ein:
Es önet sich ein Fenster, in dem Sie Ihre aktuelle Zeitzone auswählen können. Nachdem Sie die richge Zeitzone ausgewählt haben, bestägen Sie mit der OK und drücken noch einmal Enter zur Bestägung.
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
Der Beispielcode bendet sich auf der nächsten Seiten.
sudo dpkg-reconfigure tzdata
sudo python segment.py
cd /home/pi/Desktop/Joy-Pi/
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 48
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 48
Joy-Pi
Beispielcode Segment-Display:
#!/usr/bin/python # -*- coding: utf-8 -*-
import time import datetime
from Adafruit_LED_Backpack import SevenSegment
segment = SevenSegment.SevenSegment(address=0x70) #segment der I2C Adresse 0x70 und die Dis-
playdefinition zuweisen
segment.begin() # Initialisierung des Displays. Muss einmal ausgeführt werden bevor das Dis-
play benutzt wird.
print "STRG+C Druecken zum beenden." #print Befehl für Ausgabe zum beenden des Scriptes
#Schleife welche dauerhaft die Zeit updated und sie auf dem Display anzeigt.
try:
while(True): now = datetime.datetime.now() hour = now.hour minute = now.minute second = now.second
segment.clear()
# Anzeige für die Stunden.
segment.set_digit(0, int(hour / 10)) # Zehnerzahlen segment.set_digit(1, hour % 10) # Einerzahlen # Anzeige für die Minuten. segment.set_digit(2, int(minute / 10)) # Zehnerzahlen segment.set_digit(3, minute % 10) # Einerzahlen
segment.set_colon(second % 2)
segment.write_display() # Wird benötigt um die Display LEDs zu updaten.
time.sleep(1) # Warte eine Sekunde
except KeyboardInterrupt:
segment.clear() segment.write_display()
Page 49
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 49
Joy-Pi
5.16 LEKTION 16: BERÜHRUNGEN ERKENNEN
Der Touch-Sensor ist sehr nützlich, wenn es um Tastenfunkonen geht. Viele Produkte auf dem Markt verwenden Touch anstelle eines Knopfdrucks, zum Beispiel Smartphones und Tablets. Der Berührungssensor bendet sich direkt unter dem DHT11 Sensor und rechts neben dem Relais. Die leicht zugängliche Posionierung auf dem Joy-Pi ermöglicht eine einfache Bedienung.
Der Berührungssensor funkoniert wie jedes andere Tastenmodul. Der einzige Unterschied besteht darin,
dass er nur berührt, ansta gedrückt werden muss. Durch Berühren des Berührungssensors schließt das
Modul eine Schaltung, da der Computer erkennt, dass der Sensor berührt wurde. Der Berührungssensor benutzt GPIO Board Pin 11.
#!/usr/bin/env python # -*- coding: utf-8 -*-
from RPi import GPIO # Bibliotheken einfügen import signal
TOUCH = 11 # TOUCH pin 11 zuweisen (Variablendeklaration).
def setup_gpio(): # Funktion setup_gpio erstellen
GPIO.setmode(GPIO.BOARD) # Benutze GPIO Pins nach GPIO Board Schema.
GPIO.setup(TOUCH, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def do_smt(channel):
print("Touch wurde erkannt")
def main():
setup_gpio() try: GPIO.add_event_detect(TOUCH, GPIO.FALLING, callback=do_smt, bouncetime=200) signal.pause() except KeyboardInterrupt: pass finally: GPIO.cleanup()
if __name__ == '__main__':
main()
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 50
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 50
Joy-Pi
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
5.17 LEKTION 17: NEIGUNGEN MIT DEM NEIGUNGSSENSOR ERKENNEN
Der Neigungssensor ermöglicht es, eine Neigung nach rechts oder links zu erkennen. Er wird in der Robo-
k und anderen Industrien verwendet, um sicherzustellen, dass Dinge gerade gehalten werden. Er ist ein
kleiner, länglicher, schwarzer Sensor, der zwischen dem DHT11-Sensor und dem Ultraschallsensor liegt. Man kann ihn leicht an dem Klang erkennen, den er macht, wenn Sie das Board zur Seite neigen. Wenn der Neigungssensor nach links geneigt ist, wird die Schaltung akviert und ein GPIO HIGH Signal wird gesendet. Bei einer Neigung nach rechts wird die Schaltung deakviert und ein GPIO LOW Signal ge­sendet.
Beispielcode:
Für dieses Beispiel müssen Sie zwischen den Modulen wechseln. Stellen Sie den Schalter Num­mer 2 der rechten Schalteinheit auf ON. Alle anderen Schalter sollten auf OFF stehen.
#!/usr/bin/python
import time import RPi.GPIO as GPIO
#tilt_pin wird definiert
tilt_pin = 15
#GPIO Modus wird auf GPIO.BOARD gesetzt
GPIO.setmode(GPIO.BOARD)
# Pin wird als Eingang festgelegt
GPIO.setup(tilt_pin, GPIO.IN)
try:
while True: #positiv ist nach rechts, negativ ist nach links geneigt if GPIO.input(tilt_pin): print ("[-] Left Tilt") else: print ("[-] Right Tilt") time.sleep(1)
except KeyboartInterrupt:
#Strg+c beendet das Programm
GPIO.cleanup()
sudo python touch.py
cd /home/pi/Desktop/Joy-Pi/
Page 51
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 51
Joy-Pi
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
5.18 LEKTION 18: VERWENDEN DER TASTER-MATRIX
Die Taster-Matrix ist ein Modul mit 16 unabhängigen Tastern, die für viele Projekte benutzt werden kön­nen wie z. B. eine Tastatur oder ein Memory-Spiel.
Die Taster-Matrix bendet sich unten in der Mie des Joy-Pi-Boards, rechts neben dem Relais.
Sie ist leicht an den 16 einzelnen Tastern zuerkennen. Die hervorragende Posionierung auf dem Board
ermöglicht eine einfache Bedienung der Taster, während man trotzdem noch einen guten Überblick über alle anderen Sensoren hat.
Die Taster-Matrix besteht aus vier Spalten und Zeilen. Die Zeilen und Spalten werden mit ihren GPIO-Pins konguriert und das Objekt BuonMatrix() wird als Schallächenvariable inialisiert. Danach können Sie jeden Taster der Matrix drücken und feststellen, welcher Taster gedrückt wurde.
In diesem Beispiel wird die Funkon acvateBuon(), nachdem ein Tasterdruck erkannt wurde, akviert, wodurch die Nummer des gedrückten Tasters angezeigt wird. Sie können diesen Code selbstverständlich nach Ihren eigenen Vorstellungen bearbeiten.
Der Beispielcode bendet sich auf den nächsten zwei Seiten.
sudo python tilt.py
cd /home/pi/Desktop/Joy-Pi/
Für dieses Beispiel müssen sie zwischen den Modulen wechseln. Stellen Sie ALLE Schalter der linken Schalteinheit auf ON. Alle anderen Schalter sollten auf OFF stehen.
Zeile (COL):
1 2 3 4
Reihe (ROW):
1
2
3 4
Page 52
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 52
Joy-Pi
Beispielcode für die Taster-Matrix:
#!/usr/bin/python # -*- coding: utf-8 -*- # Author : original author stenobot # Original Author Github: https://github.com/stenobot/SoundMatrixPi
import RPi.GPIO as GPIO import time
class ButtonMatrix():
def __init__(self):
GPIO.setmode(GPIO.BOARD)
# Die IDs der Buttons werden festgelegt self.buttonIDs = [[4,3,2,1],[8,7,6,5],[12,11,10,9],[16,15,14,13]] # GPIO Pins für die Zeilen werden deklariert. self.rowPins = [13,15,29,31] # GPIO Pins für die Spalte werden deklariert. self.columnPins = [33,35,37,22]
# Definiere Vier Inputs mit pull up Widerständen. for i in range(len(self.rowPins)): GPIO.setup(self.rowPins[i], GPIO.IN, pull_up_down = GPIO.PUD_UP)
# Definiere Vier Outputs und setze sie auf high.
for j in range(len(self.columnPins)):
GPIO.setup(self.columnPins[j], GPIO.OUT) GPIO.output(self.columnPins[j], 1)
def activateButton(self, rowPin, colPin): # Erhalte die Button Nummer btnIndex = self.buttonIDs[rowPin][colPin] - 1 print("button " + str(btnIndex + 1) + " pressed") # Verhindert mehrere Knopfdrücke in zu kurzer zeit time.sleep(.3)
def buttonHeldDown(self,pin): if(GPIO.input(self.rowPins[pin]) == 0): return True return False
Page 53
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 53
Joy-Pi
Beispielcode Taster-Matrix fortgeführt:
Führen Sie die folgende Befehle aus und versuchen Sie es selbst:
sudo python button_matrix.py
cd /home/pi/Desktop/Joy-Pi/
def main():
# Initialisierung der Button Matrix buttons = ButtonMatrix() try: while(True): for j in range(len(buttons.columnPins)): # Jeder Output Pin wird auf low gesetzt. GPIO.output(buttons.columnPins[j],0) for i in range(len(buttons.rowPins)): if GPIO.input(buttons.rowPins[i]) == 0:
buttons.activateButton(i,j)
# Nichts tun solange der Button gedrückt gehalten wird. while(buttons.buttonHeldDown(i)): pass GPIO.output(buttons.columnPins[j],1) except KeyboardInterrupt: GPIO.cleanup()
if __name__ == "__main__":
main()
Page 54
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 54
Joy-Pi
5.19 LEKTION 19: STEUERN UND VERWENDEN DES IR-SENSORS
In dieser Lekon lernen Sie, wie man den Infrarotempfänger benutzt um IR-Codes von einer Fernbedienung zu erkennen. Die Verwendung dieser Methode ist äußerst nützlich, da wir verschiedene Akonen für verschiedene Tasten festlegen können. Mit einer Fernbedienung können Sie z. B. bei jedem
Tastendruck verschiedene LEDs einschalten oder den Servomotor steuern.
Der Sensor ist im Lieferumfang enthalten, ist jedoch nicht bereits in dem Koer verbaut, sondern wird separat verpackt. Der Steckplatz des IR-Sensors bendet sich rechts neben dem DHT11-Sensor und über dem Neigungssensor. Stecken Sie den IR-Sensor wie im Bild oben zusehen in den Steckplatz. Zusätzlich benögen Sie die IR-Fernbedienung, die ebenfalls im Lieferumfang des Joy-Pi-Kits enthalten ist.
Der IR-Empfänger verwendet eine Bibliothek namens LIRC und Python-LIRC, um die Codes, die wir mit der IR-Fernbedienung senden, zu verstehen. Die Out-Variable enthält die Taste, die wir gedrückt haben. Mit Hilfe von if-Abfragen können wir überprüfen, ob besmmte Tasten gedrückt wurden. Anhand dieser In­formaonen können wir entsprechende Befehle ausführen.
Der Beispielcode bendet sich auf der nächsten Seite.
Wichg!!! Ziehen Sie den IR-Sensor aus dem Steckplatz heraus bevor Sie den Koer schließen.
Achtung! Für dieses Beispiel müssen Sie alle Schalter der linken und rechten Schalteinheit auf OFF stellen.
Page 55
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 55
Joy-Pi
Beispielcode IR-Sensor:
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
#!/usr/bin/env python # -*- coding: utf-8 -*-
import socket, signal import lirc, time, sys import RPi.GPIO as GPIO from array import array
GPIO.setmode(11) #Legt den Modus für die Pinbelegung fest "GPIO.setmode(11)"
#ist gleichbedeutend mit "GPIO.setmode(GPIO.BCM)"
GPIO.setup(17, 0) GPIO.setup(18, 0) # Pin Deklaration
#PORT = 42001
#HOST = "localhost"
Socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #Sockel Deklaration
Lirc = lirc.init("keys")
#lirc.set_blocking(False, Lirc) # Unkommentieren um das warten auf ein Signal zu #vermeiden ( Gibt leere Arrays aus wenn unkommentiert ).
def handler(signal, frame):
Socket.close() GPIO.cleanup() # Gibt GPIO Ports wieder frei. exit(0)
signal.signal(signal.SIGTSTP, handler)
def sendCmd(cmd):
n = len(cmd) a = array('c') a.append(chr((n >> 24) & 0xFF)) a.append(chr((n >> 16) & 0xFF)) a.append(chr((n >> 8) & 0xFF)) a.append(chr(n & 0xFF)) Socket.send(a.tostring() + cmd)
while True:
Out = lirc.nextcode()
print Out[0]
sudo python IR.py
cd /home/pi/Desktop/Joy-Pi/
Page 56
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 56
Joy-Pi
5.20 LEKTION 20: EIGENE SCHALTUNGEN MIT DEM BREADBOARD
Das Breadboard ist ein äußerst nützliches Teil im Joy-Pi, dass es uns ermöglicht, eigene Schaltungen und Funkonen zu erstellen. Nachdem wir gelernt haben wie man all die Sensoren benutzt, ist es nun an der
Zeit unseren eigenen zu erstellen. In dieser Lekon erstellen Sie Ihre erste benutzerdenierte Schaltung
anhand eines blinkenden LED-Beispiels. Das Breadboard ist eine sogenannte Steckplane und bendet sich in der Mie des Joy-Pis.
In diesem Beispiel wird eine benutzerdenierte Schaltung erstellt, mit der Funkon, eine LED blinken zu lassen. Um dies zu tun, müssen Sie einen GPIO-Pin als Ausgabe, wie Sie es bereits in früheren Lekonen getan haben und einen GND-Pin verwenden. Dazu wird die Servo-Schnistelle (SERVO1-Schnistelle) an GPIO 37 verwendet.
Sie können sich an diesem Bild orieneren, um Ihre Schaltung auf dem Steckbre zu erstellen. Vergessen Sie nicht, dass sich Pin Nummer 37 am GPIO-Port und GND am GND-Port der SERVO1-Schnistelle benden.
Für dieses Beispiel müssen Sie zwischen den Modulen wechseln, da die Servo-Pins verwendet
werden. Stellen Sie dafür die Schalter 7 und 8 der rechten Schalteinheit auf ON. Alle anderen Schalter sollten auf OFF stehen.
Page 57
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 57
Joy-Pi
Sie müssen einen Widerstand verwenden, und ihn an der negaven Seite der LED anschließen (die nega­ve Seite der LED ist die mit dem kürzeren Bein). Die andere Seite des Widerstands müssen Sie direkt, mit einem Kabel, mit dem GND-Pin der SERVO1-Schnistelle verbinden. Die posive Seite der LED verbinden Sie mit dem GPIO37 Pin der SERVO1-Schnistelle.
Nachdem Sie die Schaltung erfolgreich aufgebaut haben, ist es Zeit den Code zu schreiben, um die LED zu kontrollieren. Sie werden GPIO.HIGH an den SERVO1 GPIO-Pin senden, an dem die LED angeschossen ist, warten 0,2 Sekunden und schalten es mit GPIO.LOW wieder ab. Dies wiederholen Sie. Dadurch wird die LED anfangen zu blinken, bis das Programm mit STRG+C beendet wird.
Der Beispielcode bendet sich auf der nächsten Seite
Wichg: Die LED, der Widerstand und die Kabel sind nicht im Lieferumfang enthalten.
Page 58
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 58
Joy-Pi
Beispielcode Breadboard:
Führen Sie die folgenden Befehle aus und versuchen Sie es selbst:
#!/usr/bin/python
import time import RPi.GPIO as GPIO
#definiere LED Pin
led_pin = 37
#setze GPIO Modus auf GPIO.BOARD
GPIO.setmode(GPIO.BOARD)
#lege Pin als Ausgang fest
GPIO.setup(led_pin, GPIO.OUT)
try:
while True: #LED an GPIO.output(led_pin, GPIO.HIGH) #warte 0,2 Sekunden time.sleep(0.2) #LED aus GPIO.output(led_pin, GPIO.LOW) #warte 0,2 Sekunden time.sleep(0.2)
except KeyboardInterrupt:
#STRG+C zum Beenden des Programms
GPIO.cleanup()
sudo python blinking_led.py
cd /home/pi/Desktop/Joy-Pi/
Page 59
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 59
Joy-Pi
5.21 LEKTION 21: FOTOGRAFIEREN MIT DER JOY-PI KAMERA
Die Joy-Pi Kamera ist äußerst nützlich und kann für eine Vielzahl von Projekten verwendet werden. Bei­spielsweise für Sicherheitskameras, Gesichtserkennung und vieles mehr. In der folgenden Lekon werden Ihnen die Grundlagen zur Verwendung der Joy-Pi Kamera näher gebracht. Dadurch werden Sie lernen, wie man ein Foto oder ein Video macht.
Die Kamera bendet sich mig über dem Bildschirm des Joy-Pis und ist mit einem USB Kabel direkt mit
dem Raspberry Pi verbunden.
Als nächstes, nachdem Sie sichergestellt haben, dass die Kamera verbunden ist, müssen Sie das fswebcam Paket mit folgendem Befehl installieren (Das Paket ist in dem vorbereiteten Image bereits installiert):
Geben Sie den Befehl fswebcam gefolgt von einem Dateinamen ein. Mit der Webcam wird ein Bild aufgenommen und unter dem angegebenen Dateinamen gespeichert:
So können Sie ein Bild in der Auösung 1280x1024 aufnehmen:
Wenn Sie jetzt den Befehl --no-banner hinzufügen enernen Sie den Zeit- und Datumsstempel:
sudo apt-get install fswebcam
fswebcam image.jpg
fswebcam -r 1280-1024 image2.jpg
fswebcam -r 1280-1024 --no-banner image3.jpg
Page 60
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 60
Joy-Pi
Um ein Video aufzunehmen benutzen Sie den folgenden Befehl, die Auösung ist variabel.
Nun können Sie das gerade aufgenommene Video mit dem omxplayer starten:
Das Video wird nun im Vollbild wiedergegeben um das zu beenden drücken Sie STRG+C
ffmpeg -f v4l2 -r 25 -s 780x480 -i /dev/video0 Beispiel.avi
omxplayer Beispiel.avi
Page 61
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 61
Joy-Pi
Symbol auf Elektro- und Elektronikgeräten
Diese durchgestrichene Mülltonne bedeutet, dass Elektro- und Elektronikgeräte nicht in den Hausmüll
gehören. Sie müssen die Altgeräte an einer Erfassungsstelle abgeben. Vor der Abgabe haben Sie
Altbaerien und Altakkumulatoren, die nicht vom Altgerät umschlossen sind, von diesem zu trennen.
Rückgabemöglichkeiten
Als Endnutzer können Sie beim Kauf eines neuen Gerätes, Ihr Altgerät (das im Wesentlichen die gleiche Funkon wie das bei uns erworbene neue erfüllt) kostenlos zur Entsorgung abgeben. Kleingeräte bei denen keine äußere Abmessungen größer als 25 cm sind können unabhängig vom Kauf eines Neugerätes in Haushaltsüblichen Mengen abgeben werden.
Möglichkeit Rückgabe an unserem Firmenstandort während der Önungszeiten
Simac GmbH, Pascalstr. 8, D-47506 Neukirchen-Vluyn
Möglichkeit Rückgabe in Ihrer Nähe
Wir senden Ihnen eine Paketmarke zu mit der Sie das Gerät kostenlos an uns zurücksenden können.
Hierzu wenden Sie sich bie per E-Mail an Service@joy-it.net oder per Telefon an uns.
Informaonen zur Verpackung
Verpacken Sie Ihr Altgerät bie transportsicher, sollten Sie kein geeignetes Verpackungsmaterial haben oder kein eigenes nutzen möchten kontakeren Sie uns, wir lassen Ihnen dann eine geeignete Verpackung zukommen.
6. INFORMATIONS- UND RÜCKNAHMEPFLICHTEN
Page 62
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 62
Joy-Pi
Dieses Produkt enthält Soware, welche ganz oderteilweise als freie Soware den Lizenzbedingungen der GNU General Public License, Version 2 (GPL) oder X11 License (auch MIT License genannt) unterliegt. Die vollständigen Lizenztexte ersehen Sie nachfolgend. Näheres über die Lizenzbedingungen erfahren Sie unter hp://www.gnu.org/
licenses/old-licenses/gpl-2.0 und hps://www.gnu.org/licenses/license-list.html. Da es sich um freie Soware
handelt, besteht keinerlei Gewährleistung, soweit gesetzlich zulässig. Details hierzu nden Sie in der GNU General Public License und der X11 License. Bie beachten Sie, dass die Gewährleistung für die Hardware davon natürlich nicht betroen ist und in vollem Umfang besteht.
Ferner verpichten wir uns für 3 Jahre, den Quellcode auf Anfrage jeden in maschinenlesbarer Form zur Verfügung zu stellen, berechnet werden lediglich die Herstellungskosten des Mediums. Die Anfrage ist zu senden an
service@joy-it.net.
Weitere Fragen beantworten wir Ihnen gerne unter service@joy-it.net.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most soware are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to
guarantee your freedom to share and change free soware--to make sure the soware is free for all its users. This General Public License applies to most of
the Free Soware Foundaon's soware and to any other program whose authors commit to using it. (Some other Free Soware Foundaon soware is
covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
When we speak of free soware, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to
distribute copies of free soware (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the
soware or use pieces of it in new free programs; and that you know you can do these things.
To protect your rights, we need to make restricons that forbid anyone to deny you these rights or to ask you to surrender the rights. These restricons
translate to certain responsibilies for you if you distribute copies of the soware, or if you modify it.
For example, if you distribute copies of such a program, whether gras or for a fee, you must give the recipients all the rights that you have. You must make
sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the soware, and (2) oer you this license which gives you legal permission to copy, distribute and/or
modify the soware.
7. RECHTLICHES
Page 63
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 63
Joy-Pi
Also, for each author's protecon and ours, we want to make certain that everyone understands that there is no warranty for this free soware. If the
soware is modied by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced
by others will not reect on the original authors' reputaons.
Finally, any free program is threatened constantly by soware patents. We wish to avoid the danger that redistributors of a free program will individually
obtain patent licenses, in eect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free
use or not licensed at all.
The precise terms and condions for copying, distribuon and modicaon follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a noce placed by the copyright holder saying it may be distributed under the terms of
this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any
derivave work under copyright law: that is to say, a work containing the Program or a poron of it, either verbam or with modicaons and/or translated
into another language. (Hereinaer, translaon is included without limitaon in the term "modicaon".) Each licensee is addressed as "you".
Acvies other than copying, distribuon and modicaon are not covered by this License; they are outside its scope. The act of running the Program is not
restricted, and the output from the Program is covered only if its contents constute a work based on the Program (independent of having been made by
running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbam copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright noce and disclaimer of warranty; keep intact all the noces that refer to this License and to the
absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may at your opon oer warranty protecon in exchange for a fee.
2. You may modify your copy or copies of the Program or any poron of it, thus forming a work based on the Program, and copy and distribute such
modicaons or work under the terms of Secon 1 above, provided that you also meet all of these condions:
a) You must cause the modied les to carry prominent noces stang that you changed the les and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part
thereof, to be licensed as a whole at no charge to all third pares under the terms of this License.
c) If the modied program normally reads commands interacvely when run, you must cause it, when started running for such interacve
use in the most ordinary way, to print or display an announcement including an appropriate copyright noce and a noce that there is no
warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these condions, and telling the
user how to view a copy of this License. (Excepon: if the Program itself is interacve but does not normally print such an announcement,
your work based on the Program is not required to print an announcement.)
These requirements apply to the modied work as a whole. If idenable secons of that work are not derived from the Program, and can be reasonably
considered independent and separate works in themselves, then this License, and its terms, do not apply to those secons when you distribute them as
separate works. But when you distribute the same secons as part of a whole which is a work based on the Program, the distribuon of the whole must be on
the terms of this License, whose permissions for other licensees extend to the enre whole, and thus to each and every part regardless of who wrote it.
7. RECHTLICHES
Page 64
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 64
Joy-Pi
Thus, it is not the intent of this secon to claim rights or contest your rights to work wrien enrely by you; rather, the intent is to exercise the right to control
the distribuon of derivave or collecve works based on the Program.
In addion, mere aggregaon of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or
distribuon medium does not bring the other work under the scope of this License.
3. You may copy and distribute the Program (or a work based on it, under Secon 2) in object code or executable form under the terms of Secons 1 and 2
above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Secons 1
and 2 above on a medium customarily used for soware interchange; or,
b) Accompany it with a wrien oer, valid for at least three years, to give any third party, for a charge no more than your cost of physically
performing source distribuon, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of
Secons 1 and 2 above on a medium customarily used for soware interchange; or,
c) Accompany it with the informaon you received as to the oer to distribute corresponding source code. (This alternave is allowed only
for noncommercial distribuon and only if you received the program in object code or executable form with such an oer, in accord with
Subsecon b above.)
The source code for a work means the preferred form of the work for making modicaons to it. For an executable work, complete source code means all the
source code for all modules it contains, plus any associated interface denion les, plus the scripts used to control compilaon and installaon of the
executable. However, as a special excepon, the source code distributed need not include anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the operang system on which the executable runs, unless that component itself
accompanies the executable.
If distribuon of executable or object code is made by oering access to copy from a designated place, then oering equivalent access to copy the source code
from the same place counts as distribuon of the source code, even though third pares are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any aempt otherwise to copy, modify,
sublicense or distribute the Program is void, and will automacally terminate your rights under this License. However, pares who have received copies, or
rights, from you under this License will not have their licenses terminated so long as such pares remain in full compliance.
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or
its derivave works. These acons are prohibited by law if you do not accept this License. Therefore, by modifying or distribung the Program (or any work
based on the Program), you indicate your acceptance of this License to do so, and all its terms and condions for copying, distribung or modifying the
Program or works based on it.
6. Each me you redistribute the Program (or any work based on the Program), the recipient automacally receives a license from the original licensor to copy,
distribute or modify the Program subject to these terms and condions. You may not impose any further restricons on the recipients' exercise of the rights
granted herein. You are not responsible for enforcing compliance by third pares to this License.
7. If, as a consequence of a court judgment or allegaon of patent infringement or for any other reason (not limited to patent issues), condions are imposed
on you (whether by court order, agreement or otherwise) that contradict the condions of this License, they do not excuse you from the condions of this
License. If you cannot distribute so as to sasfy simultaneously your obligaons under this License and any other pernent obligaons, then as a consequence
you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribuon of the Program by all those who receive
7. RECHTLICHES
Page 65
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 65
Joy-Pi
copies directly or indirectly through you, then the only way you could sasfy both it and this License would be to refrain enrely from distribuon of the
Program. If any poron of this secon is held invalid or unenforceable under any parcular circumstance, the balance of the secon is intended to apply and
the secon as a whole is intended to apply in other circumstances.
It is not the purpose of this secon to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this secon has
the sole purpose of protecng the integrity of the free soware distribuon system, which is implemented by public license pracces. Many people have made
generous contribuons to the wide range of soware distributed through that system in reliance on consistent applicaon of that system; it is up to the
author/donor to decide if he or she is willing to distribute soware through any other system and a licensee cannot impose that choice.
This secon is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
8. If the distribuon and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder
who places the Program under this License may add an explicit geographical distribuon limitaon excluding those countries, so that distribuon is permied
only in or among countries not thus excluded. In such case, this License incorporates the limitaon as if wrien in the body of this License.
9. The Free Soware Foundaon may publish revised and/or new versions of the General Public License from me to me. Such new versions will be similar in
spirit to the present version, but may dier in detail to address new problems or concerns.
Each version is given a disnguishing version number. If the Program species a version number of this License which applies to it and "any later version", you
have the opon of following the terms and condions either of that version or of any later version published by the Free Soware Foundaon. If the Program
does not specify a version number of this License, you may choose any version ever published by the Free Soware Foundaon.
10. If you wish to incorporate parts of the Program into other free programs whose distribuon condions are dierent, write to the author to ask for
permission. For soware which is copyrighted by the Free Soware Foundaon, write to the Free Soware Foundaon; we somemes make excepons for
this. Our decision will be guided by the two goals of preserving the free status of all derivaves of our free soware and of promong the sharing and reuse of
soware generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. RECHTLICHES
Page 66
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 66
Joy-Pi
END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free soware which
everyone can redistribute and change under these terms.
To do so, aach the following noces to the program. It is safest to aach them to the start of each source le to most eecvely convey the exclusion of
warranty; and each le should have at least the "copyright" line and a pointer to where the full noce is found.
one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Also add informaon on how to contact you by electronic and paper mail.
If the program is interacve, make it output a short noce like this when it starts in an interacve mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY;
for details type `show w'. This is free software, and you are welcome to redistribute it under certain
conditions; type `show c' for details.
The hypothecal commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be
called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a
sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision'(which makes passes at
compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989
Ty Coon, President of Vice
7. RECHTLICHES
Page 67
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 67
Joy-Pi
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Soware Foundaon, Inc. <hps://fsf.org/>
Everyone is permied to copy and distribute verbam copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyle license for soware and other kinds of works.
The licenses for most soware and other praccal works are designed to take away your freedom to share and change the works. By contrast, the GNU
General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free soware for all its
users. We, the Free Soware Foundaon, use the GNU General Public License for most of our soware; it applies also to any other work released this way by
its authors. You can apply it to your programs, too.
When we speak of free soware, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to
distribute copies of free soware (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the soware
or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain
responsibilies if you distribute copies of the soware, or if you modify it: responsibilies to respect the freedom of others.
For example, if you distribute copies of such a program, whether gras or for a fee, you must pass on to the recipients the same freedoms that you received.
You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the soware, and (2) oer you this License giving you legal
permission to copy, distribute and/or modify it.
For the developers' and authors' protecon, the GPL clearly explains that there is no warranty for this free soware. For both users' and authors' sake, the GPL
requires that modied versions be marked as changed, so that their problems will not be aributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modied versions of the soware inside them, although the manufacturer can do so. This is
fundamentally incompable with the aim of protecng users' freedom to change the soware. The systemac paern of such abuse occurs in the area of
products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the pracce
for those products. If such problems arise substanally in other domains, we stand ready to extend this provision to those domains in future versions of the
GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by soware patents. States should not allow patents to restrict development and use of soware on general-
purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it eecvely proprietary. To
prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and condions for copying, distribuon and modicaon follow.
7. RECHTLICHES
Page 68
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 68
Joy-Pi
TERMS AND CONDITIONS
0. Denions.
This Licenserefers to version 3 of the GNU General Public License.
Copyrightalso means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
The Programrefers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and recipientsmay be
individuals or organizaons.
To modifya work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy.
The resulng work is called a modied versionof the earlier work or a work based onthe earlier work.
A “covered work” means either the unmodied Program or a work based on the Program.
To propagatea work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable
copyright law, except execung it on a computer or modifying a private copy. Propagaon includes copying, distribuon (with or without modicaon), making
available to the public, and in some countries other acvies as well.
To conveya work means any kind of propagaon that enables other pares to make or receive copies. Mere interacon with a user through a computer
network, with no transfer of a copy, is not conveying.
An interacve user interface displays Appropriate Legal Nocesto the extent that it includes a convenient and prominently visible feature that (1) displays an
appropriate copyright noce, and (2) tells the user that there is no warranty for the work (except to the extent that warranes are provided), that licensees
may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or opons, such as a menu, a
prominent item in the list meets this criterion.
1. Source Code.
The source codefor a work means the preferred form of the work for making modicaons to it. Object codemeans any non-source form of a work. A
Standard Interfacemeans an interface that either is an ocial standard dened by a recognized standards body, or, in the case of interfaces specied for a
parcular programming language, one that is widely used among developers working in that language.
The System Librariesof an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major
Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a
Standard Interface for which an implementaon is available to the public in source code form. A Major Component”, in this context, means a major essenal
component (kernel, window system, and so on) of the specic operang system (if any) on which the executable work runs, or a compiler used to produce the
work, or an object code interpreter used to run it.
The Corresponding Sourcefor a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object
code and to modify the work, including scripts to control those acvies. However, it does not include the work's System Libraries, or general-purpose tools or
generally available free programs which are used unmodied in performing those acvies but which are not part of the work. For example, Corresponding
Source includes interface denion les associated with source les for the work, and the source code for shared libraries and dynamically linked subprograms
that the work is specically designed to require, such as by inmate data communicaon or control ow between those subprograms and other parts of the
work.
The Corresponding Source need not include anything that users can regenerate automacally from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
7. RECHTLICHES
Page 69
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 69
Joy-Pi
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated condions are met. This License explicitly arms your unlimited permission to run the unmodied Program. The output from running a covered work is covered by this License only if the output, given its content, constutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without condions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modicaons exclusively for you, or provide you with facilies for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direcon and control, on terms that prohibit them from making any copies of your copyrighted material outside their relaonship with you. Conveying under any other circumstances is permied solely under the condions stated below. Sublicensing is not allowed; secon 10 makes it unnecessary.
3. Protecng Users' Legal Rights From An-Circumvenon Law.
No covered work shall be deemed part of an eecve technological measure under any applicable law fullling obligaons under arcle 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibing or restricng circumvenon of such measures. When you convey a covered work, you waive any legal power to forbid circumvenon of technological measures to the extent such circumvenon is eected by exercising rights under this License with respect to the covered work, and you disclaim any intenon to limit operaon or modicaon of the work as a means of enforcing, against the work's users, your or third pares' legal rights to forbid circumvenon of technological measures.
4. Conveying Verbam Copies.
You may convey verbam copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright noce; keep intact all noces stang that this License and any non-permissive terms added in accord with secon 7 apply to the code; keep intact all noces of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may oer support or warranty protecon for a fee.
5. Conveying Modied Source Versions.
You may convey a work based on the Program, or the modicaons to produce it from the Program, in the form of source code under the terms of secon 4, provided that you also meet all of these condions:
a) The work must carry prominent noces stang that you modied it, and giving a relevant date. b) The work must carry prominent noces stang that it is released under this License and any condions added under secon 7. This requirement modies the requirement in secon 4 to keep intact all noces”. c) You must license the enre work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable secon 7 addional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License
gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interacve user interfaces, each must display Appropriate Legal Noces; however, if the Program has interacve interfaces that do not display Appropriate Legal Noces, your work need not make them do so.
A compilaon of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribuon medium, is called an aggregateif the compilaon and its resulng copyright are not used to limit the access or legal rights of the compilaon's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of secons 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribuon medium), accompanied by the Corresponding Source xed on a durable physical medium customarily used for soware interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribuon medium), accompanied by a wrien oer, valid for at least three years and valid for as long as you oer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the soware in the product that is covered by this License, on a durable physical medium customarily used for soware interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the wrien oer to provide the Corresponding Source. This alternave is allowed only occasionally and noncommercially, and only if you received the object code with such an oer, in accord with subsecon 6b.
d) Convey the object code by oering access from a designated place (gras or for a charge), and oer equivalent access to the Corresponding
Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a dierent server (operated by you or a third party) that supports equivalent copying facilies, provided you maintain clear direcons next to the object code saying where to nd the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to sasfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being oered to the general public at no charge under subsecon 6d.
7. RECHTLICHES
Page 70
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 70
Joy-Pi
A separable poron of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying
the object code work.
A “User Product” is either (1) a consumer product”, which means any tangible personal property which is normally used for personal, family, or household
purposes, or (2) anything designed or sold for incorporaon into a dwelling. In determining whether a product is a consumer product, doubul cases shall be
resolved in favor of coverage. For a parcular product received by a parcular user, normally usedrefers to a typical or common use of that class of product,
regardless of the status of the parcular user or of the way in which the parcular user actually uses, or expects or is expected to use, the product. A product is
a consumer product regardless of whether the product has substanal commercial, industrial or non-consumer uses, unless such uses represent the only
signicant mode of use of the product.
Installaon Informaonfor a User Product means any methods, procedures, authorizaon keys, or other informaon required to install and execute
modied versions of a covered work in that User Product from a modied version of its Corresponding Source. The informaon must suce to ensure that the
connued funconing of the modied object code is in no case prevented or interfered with solely because modicaon has been made.
If you convey an object code work under this secon in, or with, or specically for use in, a User Product, and the conveying occurs as part of a transacon in
which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a xed term (regardless of how the transacon is
characterized), the Corresponding Source conveyed under this secon must be accompanied by the Installaon Informaon. But this requirement does not
apply if neither you nor any third party retains the ability to install modied object code on the User Product (for example, the work has been installed in
ROM).
The requirement to provide Installaon Informaon does not include a requirement to connue to provide support service, warranty, or updates for a work
that has been modied or installed by the recipient, or for the User Product in which it has been modied or installed. Access to a network may be denied
when the modicaon itself materially and adversely aects the operaon of the network or violates the rules and protocols for communicaon across the
network.
Corresponding Source conveyed, and Installaon Informaon provided, in accord with this secon must be in a format that is publicly documented (and with
an implementaon available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Addional Terms.
Addional permissionsare terms that supplement the terms of this License by making excepons from one or more of its condions. Addional permissions
that are applicable to the enre Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If
addional permissions apply only to part of the Program, that part may be used separately under those permissions, but the enre Program remains governed
by this License without regard to the addional permissions.
When you convey a copy of a covered work, you may at your opon remove any addional permissions from that copy, or from any part of it. (Addional
permissions may be wrien to require their own removal in certain cases when you modify the work.) You may place addional permissions on material,
added by you to a covered work, for which you have or can give appropriate copyright permission.
7. RECHTLICHES
Page 71
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 71
Joy-Pi
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material)
supplement the terms of this License with terms:
a) Disclaiming warranty or liming liability dierently from the terms of secons 15 and 16 of this License; or
b) Requiring preservaon of specied reasonable legal noces or author aribuons in that material or in the Appropriate Legal Noces displayed
by works containing it; or
c) Prohibing misrepresentaon of the origin of that material, or requiring that modied versions of such material be marked in reasonable ways as
dierent from the original version; or
d) Liming the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnicaon of licensors and authors of that material by anyone who conveys the material (or modied versions of it) with
contractual assumpons of liability to the recipient, for any liability that these contractual assumpons directly impose on those licensors and
authors.
All other non-permissive addional terms are considered further restriconswithin the meaning of secon 10. If the Program as you received it, or any part
of it, contains a noce stang that it is governed by this License along with a term that is a further restricon, you may remove that term. If a license document
contains a further restricon but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that
license document, provided that the further restricon does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this secon, you must place, in the relevant source les, a statement of the addional terms that apply to
those les, or a noce indicang where to nd the applicable terms.
Addional terms, permissive or non-permissive, may be stated in the form of a separately wrien license, or stated as excepons; the above requirements
apply either way.
8. Terminaon.
You may not propagate or modify a covered work except as expressly provided under this License. Any aempt otherwise to propagate or modify it is void, and
will automacally terminate your rights under this License (including any patent licenses granted under the third paragraph of secon 11).
However, if you cease all violaon of this License, then your license from a parcular copyright holder is reinstated (a) provisionally, unless and unl the
copyright holder explicitly and nally terminates your license, and (b) permanently, if the copyright holder fails to nofy you of the violaon by some
reasonable means prior to 60 days aer the cessaon.
Moreover, your license from a parcular copyright holder is reinstated permanently if the copyright holder noes you of the violaon by some reasonable
means, this is the rst me you have received noce of violaon of this License (for any work) from that copyright holder, and you cure the violaon prior to
30 days aer your receipt of the noce.
Terminaon of your rights under this secon does not terminate the licenses of pares who have received copies or rights from you under this License. If your
rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under secon 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagaon of a covered work occurring solely as a
consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you
permission to propagate or modify any covered work. These acons infringe copyright if you do not accept this License. Therefore, by modifying or propagang
a covered work, you indicate your acceptance of this License to do so.
7. RECHTLICHES
Page 72
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 72
Joy-Pi
10. Automac Licensing of Downstream Recipients.
Each me you convey a covered work, the recipient automacally receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third pares with this License. An enty transaconis a transacon transferring control of an organizaon, or substanally all assets of one, or subdividing an organizaon, or merging organizaons. If propagaon of a covered work results from an enty transacon, each party to that transacon who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable eorts. You may not impose any further restricons on the exercise of the rights granted or armed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not iniate ligaon (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, oering for sale, or imporng the Program or any poron of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's contributor version”. A contributor's essenal patent claimsare all patent claims owned or controlled by the contributor, whether already acquired or hereaer acquired, that would be infringed by some manner, permied by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modicaon of the contributor version. For purposes of this denion, controlincludes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essenal patent claims, to make, use, sell, oer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a patent licenseis any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to pracce a patent or covenant not to sue for patent infringement). To grantsuch a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benet of the patent license for this parcular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. Knowingly relyingmeans you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more idenable patents in that country that you have reason to believe are valid. If, pursuant to or in connecon with a single transacon or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a
patent license to some of the pares receiving the covered work authorizing them to use, propagate, modify or convey a specic copy of the covered work,
then the patent license you grant is automacally extended to all recipients of the covered work and works based on it. A patent license is discriminatoryif it does not include within the scope of its coverage, prohibits the exercise of, or is condioned on the non-exercise of one or more of the rights that are specically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distribung soware, under which you make payment to the third party based on the extent of your acvity of conveying the work, and under which the third party grants, to any of the pares who would receive the covered work from you, a discriminatory patent license (a) in connecon with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connecon with specic products or compilaons that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or liming any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If condions are imposed on you (whether by court order, agreement or otherwise) that contradict the condions of this License, they do not excuse you from the condions of this License. If you cannot convey a covered work so as to sasfy simultaneously your obligaons under this License and any other pernent obligaons, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could sasfy both those terms and this License would be to refrain enrely from conveying the Program.
13. Use with the GNU Aero General Public License.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Aero General Public License into a single combined work, and to convey the resulng work. The terms of this License will connue to apply to the part
which is the covered work, but the special requirements of the GNU Aero General Public License, secon 13, concerning interacon through a network will
apply to the combinaon as such.
14. Revised Versions of this License.
The Free Soware Foundaon may publish revised and/or new versions of the GNU General Public License from me to me. Such new versions will be similar in spirit to the present version, but may dier in detail to address new problems or concerns. Each version is given a disnguishing version number. If the Program species that a certain numbered version of the GNU General Public License or any later versionapplies to it, you have the opon of following the terms and condions either of that numbered version or of any later version published by the Free Soware Foundaon. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Soware Foundaon. If the Program species that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you addional or dierent permissions. However, no addional obligaons are imposed on any author or copyright holder as a result of your choosing to follow a later version.
7. RECHTLICHES
Page 73
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 73
Joy-Pi
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM AS ISWITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitaon of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/ OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretaon of Secons 15 and 16.
If the disclaimer of warranty and limitaon of liability provided above cannot be given local legal eect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connecon with the Program, unless a warranty or assumpon of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free soware which everyone can redistribute and change under these terms. To do so, aach the following noces to the program. It is safest to aach them to the start of each source le to most eecvely state the exclusion of warranty; and each le should have at least the copyrightline and a pointer to where the full noce is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free soware: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Soware Foundaon, either version 3 of the License, or (at your opon) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <hps://www.gnu.org/licenses/>. Also add informaon on how to contact you by electronic and paper mail. If the program does terminal interacon, make it output a short noce like this when it starts in an interacve mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free soware, and you are welcome to redistribute it under certain condions; type `show c' for details. The hypothecal commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be dierent; for a GUI interface, you would use an about box”. You should also get your employer (if you work as a programmer) or school, if any, to sign a copyright disclaimerfor the program, if necessary. For more informaon on this, and how to apply and follow the GNU GPL, see <hps://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporang your program into proprietary programs. If your program is a subroune library, you may
consider it more useful to permit linking proprietary applicaons with the library. If this is what you want to do, use the GNU Lesser General Public License
instead of this License. But rst, please read <hps://www.gnu.org/licenses/why-not-lgpl.html>.
7. RECHTLICHES
Page 74
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 74
Joy-Pi
7. RECHTLICHES
Page 75
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 75
Joy-Pi
This General Public License does not permit incorporang your program into proprietary programs. If your program is a subroune library, you may consider it
more useful to permit linking proprietary applicaons with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this
License.
X11 License (MIT License)
Copyright (C) 1996 X Consorum
Permission is hereby granted, free of charge, to any person obtaining a copy of this soware and associated documentaon les (the "Soware"), to deal in the Soware without restricon, including without limitaon the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Soware, and to permit persons to whom the Soware is furnished to do so, subject to the following condions:
The above copyright noce and this permission noce shall be included in all copies or substanal porons of the Soware.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this noce, the name of the X Consorum shall not be used in adversing or otherwise to promote the sale, use or other dealings in this Soware without prior wrien authorizaon from the X Consorum.
X Window System is a trademark of X Consorum, Inc.
Python library to read the DHT series of humidity and temperature sensors on a Raspberry Pi or Beaglebone Black. Designed specically to work with the Adafruit DHT series sensors ----> hps://www.adafruit.com/products/385 Currently the library is tested with Python 2.6, 2.7, 3.3 and 3.4. It should work with Python greater than 3.4, too.
Dependencies
For all plaorms (Raspberry Pi and Beaglebone Black) make sure your system is able to compile and download Python extensions with pip:
On Raspbian or Beaglebone Black's Debian/Ubuntu image you can ensure your system is ready by running one or two of the following sets of commands:
Adafruit Python DHT Sensor Library
Installing
7. RECHTLICHES
Page 76
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 76
Joy-Pi
Compile and install from the repository
First download the library source code from the GitHub releases page, unzipping the archive, and execute: Python 2:
cd Adafruit_Python_DHT
Python 3:
cd Adafruit_Python_DHT
You may also git clone the repository if you want to test an unreleased version:
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
See example of usage in the examples folder.
Adafruit invests me and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Wrien by Tony DiCola for Adafruit Industries. MIT license, all text above must be included in any redistribuon
This library has been deprecated! We are leaving this up for historical and research purposes but archiving the repository. We are now only supporng the use of our CircuitPython libraries for use with Python. Check out this guide for info on using character LCDs with the CircuitPython library: hps://learn.adafruit.com/character-lcds/python-circuitpython
Adafruit_Python_CharLCD
Python library for accessing Adafruit character LCDs from a Raspberry Pi or BeagleBone Black. Designed specically to work with the Adafruit character LCDs ----> hps://learn.adafruit.com/character-lcds/overview For all plaorms (Raspberry Pi and Beaglebone Black) make sure you have the following dependencies: sudo apt-get update
For a Raspberry Pi make sure you have the RPi.GPIO library by execung:
sudo pip install RPi.GPIO
For a BeagleBone Black make sure you have the Adafruit_BBIO library by execung:
sudo pip install Adafruit_BBIO
Install the library by downloading with the download link on the right, unzipping the archive, navigang inside the library's directory and execung:
sudo python setup.py install
See example of usage in the examples folder. Adafruit invests me and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Wrien by Tony DiCola for Adafruit Industries. MIT license, all text above must be included in any redistribuon
Usage
Author
DEPRECATED LIBRARY. Adafruit Python CharLCD
7. RECHTLICHES
Page 77
Veröffentlicht: 18.04.2019 Copyright by Joy-IT 77
Joy-Pi
Wir sind auch nach dem Kauf für Sie da. Sollten noch Fragen oen bleiben oder Probleme auauchen stehen wir Ihnen auch per E-Mail, Telefon und Ticket-Supportsystem zur Seite.
E-Mail: service@joy-it.net
Ticket-System: hp://support.joy-it.net
Telefon: +49 (0)2845 98469 66 (10- 17 Uhr)
Für weitere Informaonen besuchen Sie unsere Website:
www.joy-it.net
8. SUPPORT
Loading...