Ultraschall
Miss die Entfernung von Objekten mit dem Entfernungssensor.
In diesem Tutorial lernst du die Verwendung des Ultraschall Entfernungssensors, um kreative Ideen in die Realität umsetzen zu können.
Ultraschall Entfernungssensor (Ausgabe im Terminal)
1 | import sys |
2 | sys.path.append('/home/pi/raspbotics/Pythonboard_Module/RFID') |
3 | sys.path.append('/home/pi/raspbotics/Pythonboard_Module/LED_Matrix') |
4 | sys.path.append('/home/pi/raspbotics/Pythonboard_Module') |
5 | from RPi import GPIO |
6 | GPIO.setmode(GPIO.BCM) |
7 | import time |
8 | from Entfernung import * |
21 | |
22 | try: |
23 | while 1: |
24 | Entfernung = round(distanz(),1) |
40 | print Entfernung |
18 | time.sleep(0.5) |
41 | except KeyboardInterrupt: |
42 | GPIO.cleanup() |