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/13 23:20] ristigl [Portexpander] |
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." |