# GPIO vervenden #
## Installation ##
### Um neue Software zu suchen
1. sudo apt-get update
2. sudo apt-get upgrade
### GPIO Software installieren
1. sudo apt-get install python-dev
2. sudo apt-get install python-rpi.gpio
### Adafruit Beispiele installieren
1. sudo apt-get install git
2. git clone http://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git
3. cd Adafruit-Raspberry-Pi-Python-Code
4. ls
## Wo ist welcher PIN?
[[ http://pinout.xyz/ ]]
##Eine LED verbinden
Bild von adafruit.com
##LED mit Python-Interpreter steuern
import RPi.GPIO as GPIO ## Importiere GPIO Bibliothek import time ## Damit man Warten kann GPIO.setmode(GPIO.BOARD) ## Nutze BOARD PIN-Nummerierung GPIO.setup(7, GPIO.OUT) ## PIN 7 soll ein Ausgang sein GPIO.output(7,True) ## Schalte GPIO pin 7 an GPIO.output(7,False) ## Schalte GPIO pin 7 an GPIO.cleanup() ## Um das ganze sauber zu beenden## Kleines Blink-Programm
import RPi.GPIO as GPIO ## Importiere GPIO Bibliothek
import time ## Damit man Warten kann
GPIO.setmode(GPIO.BOARD) ## Nutze BOARD PIN-Nummerierung
GPIO.setup(7, GPIO.OUT) ## PIN 7 soll ein Ausgang sein
##Define a function named Blink()
def Blink(numTimes,speed):
for i in range(0,numTimes):## Run loop numTimes
print "Iteration " + str(i+1)## Print current loop
GPIO.output(7,True)## Switch on pin 7
time.sleep(speed)## Wait
GPIO.output(7,False)## Switch off pin 7
time.sleep(speed)## Wait
print "Done" ## When loop is complete, print "Done"
GPIO.cleanup()
## Ask user for total number of blinks and length of each blink
iterations = raw_input("Enter total number of times to blink: ")
speed = raw_input("Enter length of each blink(seconds): ")
## Start Blink() function. Convert user input from strings to numeric data types and pass to Blink() as parameters
Blink(int(iterations),float(speed))
## Beispiel für Luftfeuchte- und Temperatursensor
Bild von adafruit.com
1. sudo apt-get install build-essential python-dev python-openssl
2. git clone https://github.com/adafruit/Adafruit_Python_DHT.git
3. cd Adafruit_Python_DHT/
4. sudo python setup.py install
5. cd examples/
6. sudo ./AdafruitDHT.py 11 4
## Links
[[ http://www.thirdeyevis.com/pi-page-2.php ]]
[[ https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/overview ]]
[[ https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/overview ]]