def __init__(self,interval_secs,altitude) : self.name="barometer" self.baro = BMP085() self.interval_secs = interval_secs self.altitude = altitude self.pressure = None self.temperature = None
def sendBMP(tempC,preshPa,altitudeM): bmp = BMP085(0x77) # Temp, pressure, altitude sensor port = '/dev/ttyACM0' ser = serial.Serial(port, 9600) print "SENDING BMP\n" # BMP085 Barometic Pressure Sensor # includes Temperature and Altitude tempF = 1.8*tempC + 32 altitudeF = altitudeM*3.28084 #send commands ser.write("\r\n") ser.write("\r\n") ser.write("send ") ser.write("KF7VHP-1") ser.write(" BMP:") ser.write("T:%dF" % int(tempF)) ser.write("P:%dhPa" % int(preshPa)) ser.write("A:%df" % int(altitudeF)) ser.write("\r\n") time.sleep(3)
def main(): #Set DATA pin DHT = 4 try: global temp subprocess.call(['mosquitto_pub', '-t', 'pooz/measuring', '-h', 'adveisorgroup2.lsr.ei.tum.de', '-m', "1"]) while True: if GPIO.input(18) == False: subprocess.call(['mosquitto_pub', '-t', 'pooz/fireflag', '-h', 'adveisorgroup2.lsr.ei.tum.de', '-m', "0"]) bmp = BMP085(0x77) temp = bmp.readTemperature() pressure = bmp.readPressure() altitude = bmp.readAltitude() lightLevel=bh1750.readLight() now = datetime.datetime.now() uv_value = uv.veml6070_sensor.getUVIntensity() print ("Temperature: %.2f C" % temp) print ("Pressure: %.2f hPa" % (pressure / 100.0)) print ("Altitude: %.2f" % altitude) h,t = dht.read_retry(dht.DHT22, DHT) print('Temp={0:0.1f}*C \nHumidity={1:0.1f}%\n\n'.format(t,h)) print("Light Level : " + format(lightLevel,'.2f') + " lx") print("UV Value: {0}".format(round(uv_value,2))) mine.write(h, temp, pressure, lightLevel) # f.write("Date: {}, Temperature: {}, Humidity: {}, Light: {}".format(now.strftime("%Y-%m-%d %H:%M:%S"),t, h, lightLevel)) print("Publishing message to topic","pooz/") subprocess.call(['mosquitto_pub', '-t', 'pooz/temperature', '-h', 'adveisorgroup2.lsr.ei.tum.de', '-m', str(round(temp, 2))]) subprocess.call(['mosquitto_pub', '-t', 'pooz/humidity', '-h', 'adveisorgroup2.lsr.ei.tum.de', '-m', str(round(h,2))]) subprocess.call(['mosquitto_pub', '-t', 'pooz/pressure', '-h', 'adveisorgroup2.lsr.ei.tum.de', '-m', str(round(pressure,2))]) subprocess.call(['mosquitto_pub', '-t', 'pooz/lightlevel', '-h', 'adveisorgroup2.lsr.ei.tum.de', '-m', str(round(lightLevel,2))]) subprocess.call(['mosquitto_pub', '-t', 'pooz/uv_value', '-h', 'adveisorgroup2.lsr.ei.tum.de', '-m', str(round(uv_value,2))]) #subprocess.call(['mosquitto_pub', '-t', 'pooz/fireflag', '-h', 'adveisorgroup2.lsr.ei.tum.de', '-m', "0"]) sleep(300) except KeyboardInterrupt: subprocess.call(['mosquitto_pub', '-t', 'pooz/measuring', '-h', 'adveisorgroup2.lsr.ei.tum.de', '-m', "0"]) print("Ended") client.loop_stop() #stop the loop GPIO.cleanup()
def get_readings(): bmp = BMP085(0x77) temp = bmp.readTemperature() pressure = bmp.readPressure() altitude = bmp.readAltitude() print "Temperature: %.2f C" % temp print "Pressure: %.2f hPa" % (pressure / 100.0) print "Altitude: %.2f" % altitude return {'temp': temp, 'pressure': pressure / 100.0, 'altitude': altitude}
def readBMP085(): bmp = BMP085.BMP085() tempiRead = bmp.read_temperature() dbgprint("Interior Temperature: " + str(tempiRead)) pressRead = bmp.read_pressure() / 100.0 dbgprint("Pressure: " + str(pressRead)) altitRead = bmp.read_altitude() dbgprint("Altitude: " + str(altitRead)) return tempiRead, pressRead, altitRead
def main(): #Set DATA pin DHT = 4 f = open("demofile2.csv", "w") f.write("Staring measurement" + "\n") f = open("demofile2.csv", "a+") try: global temp client.publish("pooz/measuring", "1") while True: if GPIO.input == False: client.publish("pooz/fireflag", "0") bmp = BMP085(0x77) temp = bmp.readTemperature() pressure = bmp.readPressure() altitude = bmp.readAltitude() #lightLevel=bh1750.readLight() now = datetime.datetime.now() print("Temperature: %.2f C" % temp) print("Pressure: %.2f hPa" % (pressure / 100.0)) print("Altitude: %.2f" % altitude) h, t = dht.read_retry(dht.DHT22, DHT) print('Temp={0:0.1f}*C \nHumidity={1:0.1f}%\n\n'.format(t, h)) print("Light Level : " + format(lightLevel, '.2f') + " lx") # f.write("Date: {}, Temperature: {}, Humidity: {}, Light: {}".format(now.strftime("%Y-%m-%d %H:%M:%S"),t, h, lightLevel)) print("Publishing message to topic", "pooz/") client.publish("pooz/temperature", str(round(temp, 2))) client.publish("pooz/humidity", str(round(h, 2))) client.publish("pooz/pressure", str(round(pressure, 2))) client.publish("pooz/lightlevel", str(round(lightLevel, 2))) client.publish("pooz/fireflag", "0") sleep(3) except KeyboardInterrupt: client.publish("pooz/measuring", "0") print("Ended") client.loop_stop() #stop the loop gpio.cleanup()
def read_bmp085(): if DEBUG: print "reading bmp085 temperature and pressure" bmp = BMP085(0x77) temp = bmp.readTemperature() pressure = bmp.readPressure() temp = round(((9.0 / 5.0) * temp + 32), 2) pressure = (pressure / 100) * 0.0295301 pressure = round(pressure, 2) if DEBUG: print "bmp085 Temperature: %.2f F" % temp print "Pressure: %.2f in." % pressure return {'temp': temp, 'pressure': pressure}
def __init__(self, dataFile='/dev/null'): self.dataFile = dataFile self.fetched = False # Initialise the BMP085 and use STANDARD mode (default value) # self.bmp = BMP085(0x77, debug=True) self.bmp = BMP085(0x77) # To specify a different operating mode, uncomment one of the following: # self.bmp = BMP085(0x77, 0) # ULTRALOWPOWER Mode # self.bmp = BMP085(0x77, 1) # STANDARD Mode # self.bmp = BMP085(0x77, 2) # HIRES Mode # self.bmp = BMP085(0x77, 3) # ULTRAHIRES Mode # Initilize HIH-6130. bus = GFDITools.guessBus() self.HIH6130 = SMBus(bus=bus) # Temporary storage array for HIH6130 data self.blockData = [0, 0, 0, 0]
def Init(): global bmp Log('Initializing ...') io.setmode(io.BOARD) io.setup(pin_buzzer,io.OUT) io.setup(pin_led_red,io.OUT) io.setup(pin_led_green,io.OUT) io.setup(pin_led_blue,io.OUT) io.setup(pin_led_yellow,io.OUT) io.setup(pin_led_white,io.OUT) io.setup(pin_led_bright_yellow,io.OUT) io.setup(pin_led_big,io.OUT) io.setup(pin_reed,io.IN) io.add_event_detect(pin_reed,io.BOTH) io.add_event_callback(pin_reed,ReedToggle) dhtreader.init() bmp = BMP085(0x77) Log('Initializing done.')
# Clock using the DS1307 RTC, 7-segment and matrix 8x8 displays, and 10DOF IMU for temperature readings # ====================================================================================================== # # Yellow 4 digit 7-Segment Display at address 0x70 sevenSeg = SevenSegment(address=0x70) # Yellow Matrix 8x8 Display at address 0x71 matrix8x8 = EightByEight(address=0x71) # Bi-Color Matrix 8x8 Display at address 0x73 #bicolor8x8 = ColorEightByEight(address=0x73) matrix8x8.setRotation(3) #bicolor8x8.setRotation(3) bmp180 = BMP085(address=0x77) print "Press CTRL+C to exit" # # Settings variables that control the loops and frequency of displays # maxSeconds = 45 dateFreq = 15.0 loopCount = 0 displayColor = 3 # # Flag variables that cause various things to be displayed when there are changes. # displayAmPm = None
def __init__(self, mode: int = STANDARD_MODE, address: int = 0x77) -> None: self.bmp = BMP085(address, mode)
# RasPi I2C Sensor - Beginning Sensor Networks # # For this script, we connect to and read data from an # I2C sensor. We use the BMP085 sensor module from Adafruit # or Sparkfun to read barometric pressure and altitude # using the Adafruit I2C Python code. import time # Import the BMP085 class from Adafruit_BMP085 import BMP085 # Instantiate an instance of the BMP085 class passing # the address of the sensor as displayed by i2cdetect. bmp085 = BMP085(0x77) # Read data until cancelled while True: try: # Read the data pressure = float(bmp085.readPressure()) / 100 altitude = bmp085.readAltitude() # Display the data print("The barometric pressure at altitude {0:.2f} " "is {1:.2f} hPa.".format(pressure, altitude)) # Wait for a bit to allow sensor to stabilize time.sleep(3) # Catch keyboard interrupt (CTRL-C) keypress
def lower_arm(): for i in reversed(range (loR, hiR)): call("echo 2=" + str(i) + " > /dev/servoblaster" , shell=True) time.sleep(smth) #Rangefinder Setup trig = 15 echo = 13 GPIO.setup(trig, OUT) GPIO.setup(echo, IN) def getRange(): time.sleep(0.3) GPIO.output(trig, True) time.sleep(0.00001) GPIO.output(trig, False) while GPIO.input(echo) == 0: signaloff = time.time() while GPIO.input(echo) == 1: signalon = time.time() timepassed = signalon - signaloff distanceCM = timepassed * 17000 #converts signal delay into CM return str(distanceCM) #Pressure and Temperature bmp = BMP085(0x77) def getTemp(): return str(bmp.readTemperature()) def getPressure(): return str(bmp.readPressure()/1000) if __name__ = '__main__': isGPS = False gpsQuery = raw_input("Is GPS connected to this unit?").lower() if gpsQuery in ('y', 'yes'): isGPS = True gpsp = GpsPoller() gpsp.start() try: while True: # get command from user os.system("clear") print "Range to target: " + getRange() print "Temp: " + getTemperature() + "C" print "Pressure: " + getPressure() + "kPa" if isGPS: print "Location: " + str(gpsd.fix.longitude) + "," + str(gpsd.fix.latitude) print "Bearing: " + getBearing() + "degrees" print "W = Forward" print "S = Backward" print "A = Left" print "D = Right" print "Space = Stop" print "O = Raise Arm" print "K = Lower Arm" print "P = Take Picture" command = raw_input("Enter Command (Q to Quit): ").lower() if command =="w": forward() time.sleep(0.5) continue elif command =="s": reverse() time.sleep(0.5) continue elif command =="a": spinLeft() time.sleep(0.5) continue elif command =="d": spinRight() time.sleep(0.5) continue elif command ==" ": allStop() time.sleep(0.5) continue elif command =="o": raise_arm() time.sleep(0.5) continue elif command =="k": lower_arm() time.sleep(0.5) continue elif command =="p": subprocess.call("raspistill -o image.jpg, shell = True) time.sleep(0.5) continue elif command =="q": if isGPS: gpsp.running = False gpsp.join() GPIO.cleanup() break else: print "Invalid Command" time.sleep(0.5) continue except (KeyboardInterrupt, SystemExit): if isGPS: gpsp.running = False gpsp.join() GPIO.cleanup()
#!/usr/bin/python from Adafruit_BMP085 import BMP085 # =========================================================================== # Example Code # =========================================================================== # Initialise the BMP085 and use STANDARD mode (default value) # bmp = BMP085(0x77, debug=True) bmp = BMP085(0x77, debug=True) # To specify a different operating mode, uncomment one of the following: # bmp = BMP085(0x77, 0) # ULTRALOWPOWER Mode # bmp = BMP085(0x77, 1) # STANDARD Mode # bmp = BMP085(0x77, 2) # HIRES Mode # bmp = BMP085(0x77, 3) # ULTRAHIRES Mode temp = bmp.readTemperature() # Read the current barometric pressure level pressure = bmp.readPressure() # To calculate altitude based on an estimated mean sea level pressure # (1013.25 hPa) call the function as follows, but this won't be very accurate altitude = bmp.readAltitude() # To specify a more accurate altitude, enter the correct mean sea level # pressure level. For example, if the current pressure level is 1023.50 hPa # enter 102350 since we include two decimal places in the integer value # altitude = bmp.readAltitude(102350)
#!/usr/bin/env python # # Flight Computer Suite for High-Altitude Ballooning using GrovePi sensors import time import datetime import grovepi from grovepi import * from subprocess import call from Adafruit_BMP085 import BMP085 buzzer_port = 2 temphum_port = 4 vibration_port = 8 hightemp_port = 2 barometer = BMP085(0x77) last_photo_time = 0 time_lapse_seconds = 10 buzzer_meters = 4000 ascent_mode = False descent_mode = False def soundBuzzer(): grovepi.pinMode(buzzer_port, "OUTPUT") grovepi.digitalWrite(buzzer_port, 1) time.sleep(1) grovepi.digitalWrite(buzzer_port, 0) time.sleep(1)
#!/usr/bin/python from Adafruit_BMP085 import BMP085 import time # =========================================================================== # Example Code # =========================================================================== # Initialise the BMP085 and use STANDARD mode (default value) # bmp = BMP085(0x77, debug=True) bmp = BMP085(0x77) # To specify a different operating mode, uncomment one of the following: # bmp = BMP085(0x77, 0) # ULTRALOWPOWER Mode # bmp = BMP085(0x77, 1) # STANDARD Mode # bmp = BMP085(0x77, 2) # HIRES Mode bmp = BMP085(0x77, 3) # ULTRAHIRES Mode while 1: temp = bmp.readTemperature() pressure = bmp.readPressure() altitude = bmp.readAltitude() localtime = time.asctime(time.localtime(time.time())) print str(localtime) + "," + str(temp) + "," + str(pressure) + "," + str( altitude) time.sleep(3)
from GPS_serial import GPS_AdafruitSensor from L3GD20 import L3GD20 from Adafruit_LSM303 import Adafruit_LSM303 from Adafruit_BMP085 import BMP085 #************************************************************** # Global Variables #************************************************************** exception_file = open('log_files/expection_report.txt', 'w') exception_file.close() #Set Altimeter i2c_data_avail = False temp = 0 pressure = 0 altimeter_and_temp = BMP085(debug=False) initial_altitude = altimeter_and_temp.readAltitude() altitude = initial_altitude #Set up Accelerometer & magnitomiter accel = Adafruit_LSM303() ax = 0 ay = 0 az = 0 magx = 0 magy = 0 magz = 0 orientation = 0 # GPS setup gps_data_avail = False
def checkBarometer(): bmp = BMP085(0x77) pressure = bmp.readPressure() pressure = pressure/100.0 return pressure
# bring needed modules into program import os import time import argparse from datetime import datetime from Adafruit_BMP085 import BMP085 import smbus import math bmp = BMP085(0x77) #PRESSURE #Temp initialse sensorFile = '/sys/bus/w1/devices/28-0000056e80cd/w1_slave' def readTempRaw(): f = open(sensorFile, 'r') lines = f.readlines() f.close() return lines def readTemp(): lines = readTempRaw() while lines[0].strip()[-3:] != 'YES': time.sleep(0.2) lines = readTempRaw() equalsPos = lines[1].find('t=') if equalsPos != -1: tempString = lines[1][equalsPos+2:] tempC = float(tempString)/1000.0 return tempC # GYRO-ACCEL Power management registers
def run(self): global s # connection global threadRunning yaw = 410 #GLOBALIZED throttle = 300 #GLOBALIZED while (threadRunning): ready = select.select([s], [], [], 1) if (ready[0]): data = s.recv(1024).strip() if (len(data) == 0): # Connection closed by server threadRunning = False else: # print('Received:', data.decode("utf-8")) # Converts thhe receive$ foxtrot = data.decode("utf-8") extract = foxtrot.split() keyboard = extract[0] xmouse = extract[1] ymouse = extract[2] scroll = extract[3] click = extract[4] yvr = extract[5] xvr = extract[6] # print ('yvr = {0}'.format(yvr)) # print ('xvr = {0}'.format(xvr)) # print(keyboard) #--------------------------------------------------------------------------------- if (keyboard == 'SPACE'): throttle = 329 print('THROTTLE RESET') if (keyboard == 'S'): throttle = throttle - 5 if (throttle <= 330): print('WARNING!!! MINIMUM THROTTLE') throttle = 330 if (keyboard == 'W'): throttle = throttle + 5 if (throttle >= 500): print('MAXIMUM') throttle = 500 if (keyboard == '-'): throttle = throttle - 20 if (throttle <= 330): throttle = 330 if (keyboard == '='): throttle = throttle + 20 if (throttle >= 500): throttle = 500 #-------------------------------------------------------------------------------- roll = int(xmouse) - 483 if (roll > 400): roll = 400 if (roll < 0): roll = 0 pitch = int(ymouse) if (pitch > 400): pitch = 400 if (keyboard == 'Q'): #or 'LCONTROL'): roll = 200 pitch = 200 if (keyboard == 'LCONTROL'): #or 'LCONTROL'): roll = 200 pitch = 200 #--------------------------------------------------------------------------------- bmp = BMP085(0x77) temp = bmp.readTemperature() pressure = bmp.readPressure() altitude = bmp.readAltitude() #--------------------------------------------------------------------------------- print(throttle) pwm.setPWM(0, 0, throttle) pwm.setPWM(1, 0, 560 - pitch) pwm.setPWM(2, 0, 160 + pitch) yaw = 410 if (keyboard == 'A' and pitch == 200): yaw = yaw - 170 if (yaw <= 240): yaw = 240 pwm.setPWM(1, 0, yaw) pwm.setPWM(2, 0, yaw) if (keyboard == 'D' and pitch == 200): yaw = 540 pwm.setPWM(1, 0, yaw) pwm.setPWM(2, 0, yaw) pwm.setPWM(3, 0, roll + 170) pwm.setPWM(4, 0, roll + 170) if (keyboard == 'UP'): pwm.setPWM(3, 0, 370) pwm.setPWM(4, 0, 370) if (keyboard == 'DOWN'): pwm.setPWM(3, 0, 570) pwm.setPWM(4, 0, 370) pwm.setPWM(5, 0, 320) #ycam init pwm.setPWM(6, 0, 350) #xcam init yaxis = int(ymouse) xaxis = int(xmouse) xcam = int(xvr) * (2 + 1 / 2) + 150 ycam = -int(yvr) * (4 + 1 / 2) + 350 pwm.setPWM(6, 0, xcam) pwm.setPWM(5, 0, ycam) print xcam, ycam #--------------------------------------------------------------------------------- global imu imu = GY80() rawyaw, rawroll, rawpitch = imu.current_orientation_euler_angles_hybrid( ) gyaw = rawyaw * 180.0 / pi gpitch = 178 - rawpitch * 180.0 / pi if gpitch > 180: gpitch = gpitch - 360 groll = rawroll * 180.0 / pi print(gpitch, groll) #--------------------------------------------------------------------------------- latitude = gpsc.fix.latitude longitude = gpsc.fix.longitude altitude2 = gpsc.fix.altitude speed = gpsc.fix.speed climb = gpsc.fix.climb #--------------------------------------------------------------------------------- volt1 = 1 serial_data = ser.readline() v1 = re.search(r'V1-(.*)', serial_data) if v1: volt1 = v1.group(1) print(volt1) #--------------------------------------------------------------------------------- stringThrottle = bytearray(str(throttle), "utf-8") stringTemp = bytearray(str(temp), "utf-8") stringAlt = bytearray(str(altitude), "utf-8") stringPitch = bytearray(str(gpitch), "utf-8") stringRoll = bytearray(str(groll), "utf-8") stringYaw = bytearray(str(gyaw), "utf-8") stringLat = bytearray(str(latitude), "utf-8") stringLong = bytearray(str(longitude), "utf-8") stringVolt1 = bytearray(str(volt1), "utf-8") stringSpeed = bytearray(str(speed), "utf-8") stringClim = bytearray(str(climb), "utf-8") data = 'THROTL' + stringThrottle.zfill( 2 ) + 'TEMP' + stringTemp + 'ALT' + stringAlt.zfill( 4 ) + 'PIT' + stringPitch + 'ROLL' + stringRoll + 'YAW' + stringYaw + 'LATI' + stringLat.zfill( 9 ) + 'LONG' + stringLong.zfill( 10 ) + 'SPEE' + stringSpeed + 'CLIM' + stringClim + 'VOLT1' + stringVolt1 #+ 'VOLT2' + stringVolt2 + 'VOLT3' + stringVolt3 + 'VOLT4' + stringVolt4 s.sendall(data.zfill(2))
from itertools import islice #SETUP~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #Pin definitions ledPin = 17 sdaPin = 2 sclPin = 3 piezoPin = 12 #I2C Port Setup (for communication with Lora boards) i2c = smbus.SMBus(1) #I2C Addresses #Barometer bmp = BMP085(0x77, 1) temp = bmp.read_temperature() pressure = bmp.read_pressure() asl = bmp.read_altitude() #0m pressure changeable via telemetry later #IMU #This code snippet from Akimach on Github: path = "../lib/liblsm9ds1cwrapper.so" lib = cdll.LoadLibrary(path) lib.lsm9ds1_create.argtypes = [] lib.lsm9ds1_create.restype = c_void_p lib.lsm9ds1_begin.argtypes = [c_void_p] lib.lsm9ds1_begin.restype = None lib.lsm9ds1_calibrate.argtypes = [c_void_p]
""" @ author = Aitor Gorrotxategi @ desc = Este programa lee los datos Temp, humedad y presión el protocolo HTTP """ # importamos las libreria que queremos usar import httplib import urllib import json import time from Adafruit_BMP085 import BMP085 #Inicializar el sensor BMP180 bmp = BMP085(0x77) USER_API_KEY = 'Q9X8CPMPFPWCAUQJ' # USER_API_KEY de la cuenta de ThingSpeak server = 'api.thingspeak.com' # Sevidor al que se quieren subir los datos #Se establece la conexión #conn es el objeto que hace referencia a la conexion TCP connTCP = httplib.HTTPSConnection(server) print("Estableciendo conexion TCP..."), connTCP.connect()#establecer conexion print("Conexion TCP establecida!") # Crear primer canal de ThingSpeak method = "POST" relative_uri = "/channels.json" # la llave se llama diccionario, las cabeceras se definen mediante dicccionarios
##--------------## TESTING = False ## If you want to test the Cut Off, Enable this (True). ##--------------## GPIO.setmode(11) GPIO.setwarnings(False) GPIO.setup(CutOff, GPIO.OUT) Devices = {"BMP085": True, "TMP102": True, "HTU21D": True, "DS18B20": False} StartTime = time.time() if Devices["HTU21D"]: HTU21D = HTU21D() if Devices["BMP085"]: bmp = BMP085(0x77, 3) time_set = False gps_set_success = False bus = smbus.SMBus(1) DNull = open('/dev/null', 'w') os.system("chmod +x ./DHT") Parser = argparse.ArgumentParser( description= "Parse and decipher GPS signals from serial. Output to Tx with flightmode enabled." ) Parser.add_argument('-c', nargs='?', help='Custom Callsign for the Tx.') Parser.add_argument('-p', action='store_const', const='picture',
def __init__(self,name,address=0x77,mode=1,debug=False): Sensor.__init__(self,name) ADA_BMP085.__init__(self,address, mode, debug)
sys.path.insert(0, lib_path2) from Adafruit_7Segment import SevenSegment import eeml import eeml.datastream import eeml.unit # =========================================================================== # Example Code # =========================================================================== # Initialise the BMP085 and use STANDARD mode (default value) # bmp = BMP085(0x77, debug=True) ###bmp = BMP085(0x77) bmp = BMP085(0x77, 2) # To specify a different operating mode, uncomment one of the following: # bmp = BMP085(0x77, 0) # ULTRALOWPOWER Mode # bmp = BMP085(0x77, 1) # STANDARD Mode # bmp = BMP085(0x77, 2) # HIRES Mode # bmp = BMP085(0x77, 3) # ULTRAHIRES Mode # COSM variables. The API_KEY and FEED are specific to your COSM account and must be changed API_KEY = 'USE_YOUR_API_KEY' FEED = 987654 API_URL = '/v2/feeds/{feednum}.xml' .format(feednum = FEED) # Initialize a LED display
from Adafruit_BMP085 import BMP085 from TSL2561 import TSL2561 from ADC import MCP3008ADC import SI1145 as SI1145 import Adafruit_DHT from Fusion import LSM9DS0R, LSM9DS0P, LSM9DS0Y, LSM9DS0X, LSM9DS0AY, LSM9DS0Z # Initialise Sensors bmp = BMP085(0x77) # Temp, pressure, altitude sensor # we may want bmp = BMP085(0x77, 0) # ULTRALOWPOWER Mode tsl = TSL2561() # Lux sensor #sensor = SI1145.SI1145() # print "" # BMP085 Barometic Pressure Sensor # includes Temperature and Altitude print "BMP085 - Temperature, Barometic Pressure, Altitude" print "-------------------------------------------------------------" print "Temperature:%f C " % bmp.readTemperature() print "Pressure: %f hPa" % (bmp.readPressure() / 100.0) print "Altitude: %f m " % bmp.readAltitude() print "" print "" print ""
def Init(): global bmp Log('Initializing ...') bmp = BMP085(0x77,2) Log('Initializing done.')