44 lines
885 B
Python
44 lines
885 B
Python
from picamera import PiCamera
|
|
|
|
class RaspySensors:
|
|
'''Class to handle all sensors'''
|
|
#Air Temp&Humidity
|
|
dht22 = 0
|
|
|
|
#Earth Humidity
|
|
|
|
|
|
#Brightness Sensor
|
|
|
|
|
|
#PiCamera
|
|
camera = PiCamera()
|
|
|
|
#GPS
|
|
|
|
#Varaibles
|
|
sensorData ={
|
|
"Air Temperature" : 0,
|
|
"Air Humidity" : 0,
|
|
"Earth Humidity" : 0,
|
|
"Brightness" : 0
|
|
}
|
|
image = 0
|
|
position = 0
|
|
|
|
def __init__(self) -> None:
|
|
'''Init all Sensors
|
|
#Message if Error'''
|
|
dht22 = adafruit_dht.DHT22(board.D4, use_pulseio=False)
|
|
|
|
def readSensors(self):
|
|
'''Read all Sensors and return Dictionary with data'''
|
|
return self.sensorData
|
|
|
|
def takePicture(self):
|
|
'''Take picture and return image'''
|
|
return self.image
|
|
|
|
def readPosition(self):
|
|
'''Read and return Position'''
|
|
return self.position |