def __init__(self): """ initialize the turbidity meter """ self._adc = ADS1115() self._id = 0 self._gain = 1
def __init__(self, logger=None): self._pin = 0 # ADS1115 Channel to use self._logger = logger if logger == None: self._logger = Logger("EC", Logger.INFO) # Create an ADS1115 ADC (16-bit) instance. self._adc = ADS1115(logger)
def __init__(self): self.inletPressure = 0 self.outletPressure = 0 self.conversionFactor = 3.392 self.inletRange = 200 # sensor range is 0-200 psi self.outletRange = 200 # sensor range is 0-200 psi self.ambientOffset = 12.86 # reading of ambient pressure self.adc = ADS1115() self.lock = threading.Lock() self.cv = threading.Condition(self.lock) self.shutdown = False
import bme280 from ADS1115 import ADS1115 # def blink(seconds, rgb): # pycom.rgbled(rgb) # time.sleep(seconds/2) # pycom.rgbled(0x000000) # off # time.sleep(seconds/2) # pycom.heartbeat(False) i2c = I2C(0, I2C.MASTER, pins=('P10', 'P9'), baudrate=100000) scan = i2c.scan() print("scan ", scan) bme = bme280.BME280(i2c=i2c) # Default address for adc is 0x48 (72 dec) adc = ADS1115(i2c, address=0x48) for i in range(1): # # print("scan", i, " - ", scan) if len(scan) > 0: print("\nChannel 0 voltage: {}V".format(adc.get_voltage(0))) print("Channel 0 ADC value: {}\n".format(adc.read(0))) # print("bme:", bme.formated_values) # blink(1, 0xffffff) # blink white # else: # blink(1, 0xff0000) # blink red
from ADS1115 import ADS1115 from MCP3008 import MCP3008 import logging import time import device_repo as dr import sensor_repo as sr import utils CONTEXT = "relay_sensors" THRESHOLD = 20 utils.setup_logging(CONTEXT) device_repo = dr.device_repo() sensor_repo = sr.sensor_repo() ads = ADS1115() try: while True: relay_sensors = utils.retry_if_none( lambda: device_repo.get_relay_sensors()) for relay_sensor in relay_sensors: device = utils.retry_if_none( lambda: device_repo.get_device(relay_sensor['relay'])) device_name = utils.retry_if_none( lambda: device_repo.get_device_name(device)) if (device_name is None): continue measurements = []
def __init__(self): self._adc = ADS1115() self._id = 0 self._gain = 1
# Distributed with a free-will license. # Use it any way you want, profit or free, provided it fits in the licenses of its associated works. # ADS1115 # This code is designed to work with the ADS1115_I2CADC I2C Mini Module available from ControlEverything.com. # https://www.controleverything.com/content/Analog-Digital-Converters?sku=ADS1115_I2CADC#tabs-0-product_tabset-2 import time from ADS1115 import ADS1115 ads1115 = ADS1115() while True: ads1115.set_channel() ads1115.config_differential() time.sleep(0.1) adc = ads1115.read_adc() print "Digital Value of Analog Input : %d " % (adc['r']) print " ********************************************* " time.sleep(0.8)
def __init__(self): self.adc = ADS1115() self.pgx = 1