2017-04-15 18:43:12 +02:00
|
|
|
"""
|
|
|
|
Enthaelt die Klasse fuer die Sensoren
|
|
|
|
@author kf
|
|
|
|
@since 2017-04-15
|
|
|
|
"""
|
|
|
|
from sensoren.boolsensor import Boolsensor as BOOLSENSOR
|
2017-04-16 01:32:58 +02:00
|
|
|
from sensoren.ultraschall import Ultraschall as ULTRASCHALL
|
2017-04-16 23:44:12 +02:00
|
|
|
import time
|
2017-04-16 01:32:58 +02:00
|
|
|
#from sensoren.dht11 import Dht11 as DHT11
|
2017-04-15 18:43:12 +02:00
|
|
|
class Vero(object):
|
|
|
|
def __init__(self):
|
|
|
|
self.pir=BOOLSENSOR(19);
|
2017-04-16 01:32:58 +02:00
|
|
|
#self.dht=DHT11(26);
|
2017-04-15 18:43:12 +02:00
|
|
|
#self.camera;
|
2017-04-16 01:32:58 +02:00
|
|
|
self.ultraschallLinks=ULTRASCHALL(5,17);
|
|
|
|
self.ultraschallMitte=ULTRASCHALL(6,27);
|
|
|
|
self.ultraschallRechts=ULTRASCHALL(13,22);
|
2017-04-15 18:43:12 +02:00
|
|
|
self.infarotLinks=BOOLSENSOR(12);
|
|
|
|
self.infarotRechts=BOOLSENSOR(21);
|
|
|
|
self.infarotMitteLinks=BOOLSENSOR(16);
|
|
|
|
self.infarotMitteRechts=BOOLSENSOR(20);
|
2017-04-16 23:44:12 +02:00
|
|
|
self.timestampValue=0;
|
|
|
|
def printValues(self):
|
2017-04-16 01:32:58 +02:00
|
|
|
#self.dht.setValues();
|
2018-05-29 19:38:33 +02:00
|
|
|
print("PIR: {0}".format(self.pir.getValue()));
|
2017-04-16 01:32:58 +02:00
|
|
|
#print("Temperatur: {0}".format(self.dht.getTemperatur()));
|
|
|
|
#print("Luftfeuchtigkeit: {0}".format(self.dht.getLuftfeuchtigkeit()));
|
2018-05-29 19:38:33 +02:00
|
|
|
print("Ultraschall-Links: {0}cm".format(self.ultraschallLinks.getValue()));
|
|
|
|
print("Ultraschall-Mitte: {0}cm".format(self.ultraschallMitte.getValue()));
|
|
|
|
print("Ultraschall-Rechts: {0}cm".format(self.ultraschallRechts.getValue()));
|
|
|
|
print("Infarot Links: {0}".format(self.infarotLinks.getValue()));
|
|
|
|
print("Infarot Mitte-Links: {0}".format(self.infarotMitteLinks.getValue()));
|
|
|
|
print("Infarot Mitte-Rechts: {0}".format(self.infarotMitteRechts.getValue()));
|
|
|
|
print("Infarot Rechts: {0}".format(self.infarotRechts.getValue()));
|
2017-04-15 18:43:12 +02:00
|
|
|
def saveToDB(self): #Speichert die Werte in der Datenbank
|
|
|
|
pass
|
2017-04-16 23:44:12 +02:00
|
|
|
def setSensorValues(self):
|
|
|
|
if(time.time() >= self.timestampValue+1): #Werte maximal jede Sekunde abspeichern
|
|
|
|
self.pirValue = self.pir.getValue();
|
|
|
|
self.infarotMitteLinksValue = self.infarotMitteLinks.getValue();
|
|
|
|
self.infarotMitteRechtsValue = self.infarotMitteRechts.getValue();
|
|
|
|
self.infarotLinksValue = self.infarotLinks.getValue();
|
|
|
|
self.infarotRechtsValue = self.infarotRechts.getValue();
|
|
|
|
self.ultraschallLinksValue = self.ultraschallLinks.getValue();
|
|
|
|
self.ultraschallMitteValue = self.ultraschallMitte.getValue();
|
|
|
|
self.ultraschallRechtsValue = self.ultraschallRechts.getValue();
|
|
|
|
self.timestampValue = time.time();
|