diff options
author | zweistein <zweistein@web> | 2016-10-29 15:25:06 +0200 |
---|---|---|
committer | Charly Root <root@www-static.glb.internetputzen.com> | 2016-10-29 15:25:06 +0200 |
commit | f52a46ee139f4867cbc23727d7350617c01e548a (patch) | |
tree | 92d7479d8d29f62965ce27b10aaedb171b9e111e /Howtos | |
parent | 425ff48ef760cc0aebdd270a6ba1ea92bb919d1d (diff) |
rename _Raspberry_Pi___42____42__Blink__42____42___.mdwn to Howtos/_Raspberry_Pi___42____42__Blink__42____42___.mdwn
Diffstat (limited to 'Howtos')
-rw-r--r-- | Howtos/_Raspberry_Pi___42____42__Blink__42____42___.mdwn | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/Howtos/_Raspberry_Pi___42____42__Blink__42____42___.mdwn b/Howtos/_Raspberry_Pi___42____42__Blink__42____42___.mdwn new file mode 100644 index 00000000..e9a6b68e --- /dev/null +++ b/Howtos/_Raspberry_Pi___42____42__Blink__42____42___.mdwn @@ -0,0 +1,102 @@ +# 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 +<img src="https://cdn-learn.adafruit.com/assets/assets/000/024/147/medium640/raspberry_pi_little_cobbler_bb.png?1427733019" alt="LED mit Raspberry Pi verbinden"> +Bild von adafruit.com + +##LED mit Python-Interpreter steuern + +<pre> +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 +</pre> + +## Kleines Blink-Programm +<pre> +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)) +</pre> + + +## Beispiel für Luftfeuchte- und Temperatursensor + +<img src="https://cdn-learn.adafruit.com/assets/assets/000/001/860/original/raspberry_pi_dht11wiring.gif?1447864313 alt="DHT-Sensor mit Raspberry Pi verbinden"> +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 + +# Raspberry Pi IoT + +Als Beispiel sendet ein Raspberry Pi den Wert eines Potentiometers auf thingspeak.com. + +Die Daten können unter dem folgenden Link angesehen werden. +[[ https://thingspeak.com/channels/127415 ]] + +## 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 ]] |