Autopilot hinzugefuegt

This commit is contained in:
Kevin Frantz
2017-04-15 23:32:58 +00:00
parent 2e82f991da
commit 7096c758a8
7 changed files with 188 additions and 17 deletions

11
sensoren/dht11.py Normal file
View File

@@ -0,0 +1,11 @@
import Adafruit_DHT
class Dht11(object):
def __init__(self,pin):
self.pin = pin;
def setValues(self):
self.humidity, self.temperature = Adafruit_DHT.read_retry(Adafruit_DHT.DHT11, self.pin)
def getLuftfeuchtigkeit(self):
return self.humidity;
def getTemperatur(self):
return self.temperature;

20
sensoren/ultraschall.py Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/python3
import time
import RPi.GPIO as GPIO
class Ultraschall(object):
def __init__(self,trigPin,echoPin):
self.trigPin=trigPin
self.echoPin=echoPin
GPIO.setup(echoPin, GPIO.IN)
GPIO.setup(trigPin, GPIO.OUT)
def getValue(self):
GPIO.output(self.trigPin, True)
time.sleep(0.00001) # 10 Mikrosekunden
GPIO.output(self.trigPin, False)
while GPIO.input(self.echoPin) == 0:
pass
start = time.time()
while GPIO.input(self.echoPin) == 1:
pass
ende = time.time()
return ((ende - start) * 34300) / 2