Metainformationen zur Seite
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
computer:raspberrypi:gpio [2013/07/12 10:16] ristigl [Pull-Up und Pull-Down] |
computer:raspberrypi:gpio [2018/03/16 21:11] (aktuell) |
||
---|---|---|---|
Zeile 26: | Zeile 26: | ||
+ | |||
+ | ===== Ansprechen über die Shell ===== | ||
+ | Um eine LED mithilfe eines Raspberry Pis zum Blinken zu bringen, benötigt man zu allererst WiringPi. | ||
+ | |||
+ | wget http://project-downloads.drogon.net/files/wiringPi.tgz | ||
+ | |||
+ | Das Programm muss nun entpackt, kompiliert und installiert werden: | ||
+ | |||
+ | <code> | ||
+ | tar xfz wiringPi.tgz | ||
+ | cd wiringPi/wiringPi | ||
+ | make | ||
+ | make install | ||
+ | cd ../gpio | ||
+ | make clean | ||
+ | </code> | ||
+ | |||
+ | Ist das Programm installiert, so lassen sich Pins wie folgt ansprechen: | ||
+ | |||
+ | /usr/local/bin/gpio -g mode 23 out | ||
+ | /usr/local/bin/gpio -g write 23 1 | ||
===== Ansprechen mit Python ===== | ===== Ansprechen mit Python ===== | ||
Zeile 36: | Zeile 57: | ||
Beipielcode: https://code.google.com/p/raspberry-gpio-python/wiki/BasicUsage | Beipielcode: https://code.google.com/p/raspberry-gpio-python/wiki/BasicUsage | ||
- | <code> | + | <code python> |
import RPi.GPIO as GPIO | import RPi.GPIO as GPIO | ||
GPIO.setmode(GPIO.BCM) | GPIO.setmode(GPIO.BCM) | ||
Zeile 66: | Zeile 87: | ||
"SDA and SCL pins have external 1k8 pull-up resistors connected. This is indeed because they are intended for I²C usage (which requires them). Unfortunately, since they are external, they can't be disabled in software. | "SDA and SCL pins have external 1k8 pull-up resistors connected. This is indeed because they are intended for I²C usage (which requires them). Unfortunately, since they are external, they can't be disabled in software. | ||
- | Having pull-up resistors means that default state of the pin in HIGH, unless they are pulled to ground. And this is exactly the problem you described." | + | Having pull-up resistors means that default state of the pin in HIGH, unless they are pulled to ground." |
- | ===== Proplem: Prellen ===== | + | ===== Problem: Prellen ===== |
{{ :computer:raspberrypi:entprellen.png}} | {{ :computer:raspberrypi:entprellen.png}} | ||
Wenn man einen Taster Anschließt, so kommt es beim Betätigen zum Prellen (Siehe Abbildung). | Wenn man einen Taster Anschließt, so kommt es beim Betätigen zum Prellen (Siehe Abbildung). | ||
Zeile 75: | Zeile 96: | ||
Quelle: http://www.mikrocontroller.net/articles/Entprellung | Quelle: http://www.mikrocontroller.net/articles/Entprellung | ||
+ | ===== Portexpander ===== | ||
+ | Kontroller-Chip, um 16 Ausgänge mit 2 Leitungen anzusteuern: | ||
+ | http://www.pollin.de/shop/dt/MDY4ODk4OTk-/Bauelemente_Bauteile/Aktive_Bauelemente/IC/MCP23S17_E_SP.html | ||
+ | https://ex.ploit.ws/themagpi/The-MagPi-issue-13-en.pdf Seite 11: | ||
+ | Laden der Treiber zulassen: | ||
+ | |||
+ | In **/etc/modprobe.d/raspi-blacklist.conf** den Eintrag für **i2c-bcm2708** einkommentieren. | ||
+ | In **/etc/modules** einen Zeile mit **i2c-dev** anlegen. | ||
+ | |||
+ | Installieren der Tools zur Ansteuerung: | ||
+ | <code> | ||
+ | sudo apt-get update | ||
+ | sudo apt-get install python-smbus | ||
+ | sudo apt-get install i2c-tools | ||
+ | sudo adduser pi i2c | ||
+ | sudo reboot | ||
+ | sudo i2cdetect -y 1 | ||
+ | </code> | ||
+ | |||
+ | ... |