예제 #1
0
 def __init__(self):
     try:
         self.sensor = adafruit_ahtx0.AHTx0(board.I2C())
         self.error = ErrorHandler()
     except Exception as e:
         print("no AHT20!!!")
         print(e)
예제 #2
0
 def __init__(self):
     self.config = LocalConfig()  # config init
     self.hx = HX711(5, 6)  # initialize scale
     self.ratio = 0  # scale ratio for calibration
     self.offset = 0
     self.value = 0
     self.result = 0
     self.data = 0
     self.error = ErrorHandler()
     self.config.get_config_data()
     if self.config.scale["calibrated"]:
         self.hx.set_offset(float(self.config.scale["offset"]))
         self.hx.set_scale(float(self.config.scale["ratio"]))
예제 #3
0
    def __init__(self):
        self.path = mapping.config_path
        self.config = configparser.ConfigParser()
        self.config.read(self.path)
        self.error_handler = ErrorHandler()

        self.settings = dict()
        self.audio = dict()
        self.scale = dict()
        self.data = dict()
        self.error = dict()

        self.usb_path = ""
        self.get_config_data()
예제 #4
0
    def __init__(self):
        self.config = LocalConfig()
        self.config.get_config_data()
        self.sensors = self.config.data
        self.error = ErrorHandler()
        # deprecated
        if self.config.data["dht22"]:
            from sensorlib.dht22 import DHT22
            self.dht22 = DHT22()
        if self.config.data["ds18b20"]:
            from sensorlib.ds1820 import DS18B20
            self.temp_sensor = DS18B20()
        if self.config.data["fft"] or self.config.data["wav"]:
            from sensorlib.microphone import Microphone
            self.microphone = Microphone()
        if self.config.data["scale"]:
            from sensorlib.scale import Scale
            self.scale = Scale()
        if self.config.data["aht20"]:
            from sensorlib.aht20 import AHT20
            self.aht20 = AHT20()

        self.data = dict()
        self.timestamp = ""
예제 #5
0
 def __init__(self):
     self.config = LocalConfig()
     self.config.get_config_data()
     self.info_helper = InfoHelper()
     self.stick_path = mapping.usb_path
     self.error = ErrorHandler()
예제 #6
0
 def __init__(self):
     self.fs = 0
     self.duration = 0
     self.error = ErrorHandler()
     self.config = LocalConfig()
예제 #7
0
# ds18b20.py
# written by Roger Woollett
# edited by anderswodenker

import os
import glob
import time
from helper.log_helper import ErrorHandler

error = ErrorHandler()


class DS18B20:
    # much of this code is lifted from Adafruit web site
    # This class can be used to access one or more DS18B20 temperature sensors
    # It uses OS supplied drivers and one wire support must be enabled
    # To do this add the line
    # dtoverlay=w1-gpio
    # to the end of /boot/config.txt
    #
    # The DS18B20 has three pins, looking at the flat side with the pins pointing
    # down pin 1 is on the left
    # connect pin 1 to GPIO ground
    # connect pin 2 to GPIO 4 *and* GPIO 3.3V via a 4k8 (4800 ohm) pullup resistor
    # connect pin 3 to GPIO 3.3V
    # You can connect more than one sensor to the same set of pins
    # Only one pullup resistor is required

    def __init__(self):
        # load required kernel modules
        os.system('sudo modprobe w1-gpio')
예제 #8
0
 def __init__(self):
     self.data = {}
     self.error = ErrorHandler()
     self.sensor = adafruit_dht.DHT22(board.D16)
예제 #9
0
 def __init__(self):
     self.sensor = adafruit_ahtx0.AHTx0(board.I2C())
     self.error = ErrorHandler()
예제 #10
0
 def __init__(self):
     self.config = LocalConfig()
     self.config.get_config_data()
     self.info_helper = InfoHelper()
     self.error = ErrorHandler()