import LM75 sensor1 = LM75.LM75() sensor1.i2c_address = 0x48 sensor2 = LM75.LM75() sensor2.i2c_address = 0x49 print("temp_c:", sensor1.getCelsius()) print("temp_f:", sensor1.getFahrenheit()) print("----------------------------------") #print("temp_c:", sensor2.getCelsius()) #print("----------------------------------")
measurement = read_SolarPV_kW_gen_now(SensorID) return measurement # 1-wire config... if 'T1w' in SensorType: print("Using 1-Wire Temperature Sensor(s)") os.system('modprobe w1-gpio') os.system('modprobe w1-therm') base_dir = '/sys/bus/w1/devices/' # LM75 config... if 'LM75' in SensorType: print("Using LM75 Temperature Sensor(s)") sensor = LM75.LM75() # TrigN config... if 'TrigN' in SensorType: print("Using Negative-Edge trigger on pin") # SolarPV config... # Assumes the I/O pin is connected directly to the output of the photo detector stuck to the front of the electricity meter # and that the output is pulled up to around 3.3V within the sensor monitoring module. # Recommend a resistor (say, 1kR) is connected in-line with the connection to the GPIO pin to protect the Pi if 'Electric_Whrs_import_today' in SensorType: for x in range(0, ActiveSensors): if SensorType[x] == 'Electric_Whrs_import_today': GPIO.setup( int(SensorLoc[x], 10), GPIO.IN, pull_up_down=GPIO.PUD_UP ) # Add pull-up here only when testing without the photo-sensor attached