예제 #1
0
    def __init__(self):

        try:
            self.bpta = upmBmpx8x.BMPX8X(1, upmBmpx8x.ADDR)
        except:
            print 'Error! BMP180 Barometric Pressure / Temperature / Altitude Sensor'
            sys.exit(1)
예제 #2
0
    def __init__(self):

        self.configuration = ConfigParser.ConfigParser()
        self.configuration.read('configuration/credentials.config')
        self.username = self.configuration.get('plotly', 'username')
        self.apikey = self.configuration.get('plotly', 'apikey')
        self.streamtoken = self.configuration.get('plotly', 'streamtoken')

        py.sign_in(self.username, self.apikey)

        self.bpta = upmBmpx8x.BMPX8X(1, upmBmpx8x.ADDR)
예제 #3
0
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import time, sys, signal, atexit
import pyupm_bmpx8x as upmBmpx8x

# Load Barometer module on i2c
myBarometer = upmBmpx8x.BMPX8X(0, upmBmpx8x.ADDR);


## Exit handlers ##
# This function stops python from printing a stacktrace when you hit control-C
def SIGINTHandler(signum, frame):
	raise SystemExit

# This function lets you run code on exit, including functions from myBarometer
def exitHandler():
	print "Exiting"
	sys.exit(0)

# Register exit handlers
atexit.register(exitHandler)
signal.signal(signal.SIGINT, SIGINTHandler)
예제 #4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import thread, time
import pyupm_bmpx8x
import mraa
import math

# i2c bus
bus = 1
pressAddress = 0x77
altitudeMeters = 165.5
#check = raw_input()

# create sensor on the bus
bmp180 = pyupm_bmpx8x.BMPX8X(bus, pressAddress)


def testIfPresent():
    test = bmp180.isAvailable()
    time.sleep(2)
    return test


def convertSeaLevel(m_iPressure):
    fPressure = m_iPressure / math.pow(1.0 - altitudeMeters / 44330, 5.255)
    return fPressure


def input_thread(CheckInput):
    check = raw_input()