Explorar el Código

Preparing magnetic Sensor

Preparing magnetic Sensor
Christian Woköck hace 3 años
padre
commit
5028c7899d
Se han modificado 2 ficheros con 13 adiciones y 4 borrados
  1. 12 3
      raspberry-pi/sensors/magneticSensor.py
  2. 1 1
      raspberry-pi/sensors/opticalSensor.py

+ 12 - 3
raspberry-pi/sensors/magneticSensor.py

@@ -1,13 +1,18 @@
+import queue
 import time
 
 from sensors.connection import globalArduinoSlave
+import logHandler
 
 conn = globalArduinoSlave()
 
 
 class MagneticSensor:
-  def __init__(self):
-    pass
+  def __init__(self, conf):
+    self.conf = conf
+    self.queue = queue.Queue()
+    self.log_handler = logHandler.get_log_handler() # neu
+    #pass
 
   def start(self):
     if not conn.isConnected():
@@ -21,4 +26,8 @@ class MagneticSensor:
     pass
 
   def read(self):
-    return conn.getMagneticField()
+    return conn.getMagneticField()
+
+  def stop(self): # neu
+    self.log_handler.log_and_print("stop magnetic sensor")
+    conn.close

+ 1 - 1
raspberry-pi/sensors/opticalSensor.py

@@ -100,7 +100,7 @@ class OpticalSensor():
     self._t  = None
     self.success = False
     self.running = True
-    self.showImage = True
+    self.showImage = False
 
   def start(self):
     self.log_handler.log_and_print("start optical sensor")