Esempio n. 1
0
def main():
    # Instantiate a BMP250E instance using default i2c bus and address
    sensor = sensorObj.BMG160()

    # For SPI, bus 0, you would pass -1 as the address, and a valid pin for CS:
    # BMG160(0, -1, 10);

    ## 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
    def exitHandler():
        print "Exiting"
        sys.exit(0)

    # Register exit handlers
    atexit.register(exitHandler)
    signal.signal(signal.SIGINT, SIGINTHandler)

    x = sensorObj.new_floatp()
    y = sensorObj.new_floatp()
    z = sensorObj.new_floatp()

    # now output data every 250 milliseconds
    while (1):
        sensor.update()

        sensor.getGyroscope(x, y, z)
        print "Gyroscope x:", sensorObj.floatp_value(x),
        print " y:", sensorObj.floatp_value(y),
        print " z:", sensorObj.floatp_value(z),
        print " degrees/s"

        # we show both C and F for temperature
        print "Compensation Temperature:", sensor.getTemperature(), "C /",
        print sensor.getTemperature(True), "F"

        print
        time.sleep(.250)
Esempio n. 2
0
File: bmx055.py Progetto: oronum/upm
def main():
    # Instantiate a BMX055 instance using default i2c bus and address
    sensor = sensorObj.BMX055()

    ## 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
    def exitHandler():
        print "Exiting"
        sys.exit(0)

    # Register exit handlers
    atexit.register(exitHandler)
    signal.signal(signal.SIGINT, SIGINTHandler)

    x = sensorObj.new_floatp()
    y = sensorObj.new_floatp()
    z = sensorObj.new_floatp()

    # now output data every 250 milliseconds
    while (1):
        sensor.update()

        sensor.getAccelerometer(x, y, z)
        print "Accelerometer x:", sensorObj.floatp_value(x),
        print " y:", sensorObj.floatp_value(y),
        print " z:", sensorObj.floatp_value(z),
        print " g"

        sensor.getGyroscope(x, y, z)
        print "Gyroscope x:", sensorObj.floatp_value(x),
        print " y:", sensorObj.floatp_value(y),
        print " z:", sensorObj.floatp_value(z),
        print " degrees/s"

        sensor.getMagnetometer(x, y, z)
        print "Magnetometer x:", sensorObj.floatp_value(x),
        print " y:", sensorObj.floatp_value(y),
        print " z:", sensorObj.floatp_value(z),
        print " uT"

        print
        time.sleep(.250)
Esempio n. 3
0
File: bmm150.py Progetto: oronum/upm
def main():
    # Instantiate a BMP250E instance using default i2c bus and address
    sensor = sensorObj.BMM150()

    # For SPI, bus 0, you would pass -1 as the address, and a valid pin for CS:
    # BMM150(0, -1, 10);

    ## 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
    def exitHandler():
        print "Exiting"
        sys.exit(0)

    # Register exit handlers
    atexit.register(exitHandler)
    signal.signal(signal.SIGINT, SIGINTHandler)

    x = sensorObj.new_floatp()
    y = sensorObj.new_floatp()
    z = sensorObj.new_floatp()

    # now output data every 250 milliseconds
    while (1):
        sensor.update()

        sensor.getMagnetometer(x, y, z)
        print "Magnetometer x:", sensorObj.floatp_value(x),
        print " y:", sensorObj.floatp_value(y),
        print " z:", sensorObj.floatp_value(z),
        print " uT"

        print
        time.sleep(.250)
Esempio n. 4
0

# Register exit handlers
atexit.register(exitHandler)
signal.signal(signal.SIGINT, SIGINTHandler)

x = sensorObj.new_floatp()
y = sensorObj.new_floatp()
z = sensorObj.new_floatp()

# now output data every 250 milliseconds
while (1):
    sensor.update()

    sensor.getAccelerometer(x, y, z)
    print "Accelerometer x:", sensorObj.floatp_value(x),
    print " y:", sensorObj.floatp_value(y),
    print " z:", sensorObj.floatp_value(z),
    print " g"

    sensor.getGyroscope(x, y, z)
    print "Gyroscope x:", sensorObj.floatp_value(x),
    print " y:", sensorObj.floatp_value(y),
    print " z:", sensorObj.floatp_value(z),
    print " degrees/s"

    sensor.getMagnetometer(x, y, z)
    print "Magnetometer x:", sensorObj.floatp_value(x),
    print " y:", sensorObj.floatp_value(y),
    print " z:", sensorObj.floatp_value(z),
    print " uT"
Esempio n. 5
0
def exitHandler():
	print "Exiting"
	sys.exit(0)

# Register exit handlers
atexit.register(exitHandler)
signal.signal(signal.SIGINT, SIGINTHandler)

x = sensorObj.new_floatp()
y = sensorObj.new_floatp()
z = sensorObj.new_floatp()

# now output data every 250 milliseconds
while (1):
        sensor.update()

        sensor.getAccelerometer(x, y, z)
        print "Accelerometer x:", sensorObj.floatp_value(x),
        print " y:", sensorObj.floatp_value(y),
        print " z:", sensorObj.floatp_value(z),
        print " g"

        sensor.getGyroscope(x, y, z)
        print "Gyroscope x:", sensorObj.floatp_value(x),
        print " y:", sensorObj.floatp_value(y),
        print " z:", sensorObj.floatp_value(z),
        print " degrees/s"

        print
	time.sleep(.250)
Esempio n. 6
0
# This function lets you run code on exit
def exitHandler():
    print "Exiting"
    sys.exit(0)


# Register exit handlers
atexit.register(exitHandler)
signal.signal(signal.SIGINT, SIGINTHandler)

x = sensorObj.new_floatp()
y = sensorObj.new_floatp()
z = sensorObj.new_floatp()

# now output data every 250 milliseconds
while (1):
    sensor.update()

    sensor.getGyroscope(x, y, z)
    print "Gyroscope x:", sensorObj.floatp_value(x),
    print " y:", sensorObj.floatp_value(y),
    print " z:", sensorObj.floatp_value(z),
    print " degrees/s"

    # we show both C and F for temperature
    print "Compensation Temperature:", sensor.getTemperature(), "C /",
    print sensor.getTemperature(True), "F"

    print
    time.sleep(.250)
Esempio n. 7
0
# This function lets you run code on exit
def exitHandler():
	print "Exiting"
	sys.exit(0)

# Register exit handlers
atexit.register(exitHandler)
signal.signal(signal.SIGINT, SIGINTHandler)

x = sensorObj.new_floatp()
y = sensorObj.new_floatp()
z = sensorObj.new_floatp()

# now output data every 250 milliseconds
while (1):
        sensor.update()

        sensor.getGyroscope(x, y, z)
        print "Gyroscope x:", sensorObj.floatp_value(x),
        print " y:", sensorObj.floatp_value(y),
        print " z:", sensorObj.floatp_value(z),
        print " degrees/s"

        # we show both C and F for temperature
        print "Compensation Temperature:", sensor.getTemperature(), "C /",
        print sensor.getTemperature(True), "F"

        print
	time.sleep(.250)
Esempio n. 8
0
## 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
def exitHandler():
	print "Exiting"
	sys.exit(0)

# Register exit handlers
atexit.register(exitHandler)
signal.signal(signal.SIGINT, SIGINTHandler)

x = sensorObj.new_floatp()
y = sensorObj.new_floatp()
z = sensorObj.new_floatp()

# now output data every 250 milliseconds
while (1):
        sensor.update()

        sensor.getMagnetometer(x, y, z)
        print "Magnetometer x:", sensorObj.floatp_value(x),
        print " y:", sensorObj.floatp_value(y),
        print " z:", sensorObj.floatp_value(z),
        print " uT"

        print
	time.sleep(.250)
Esempio n. 9
0
# This function lets you run code on exit
def exitHandler():
    print "Exiting"
    sys.exit(0)


# Register exit handlers
atexit.register(exitHandler)
signal.signal(signal.SIGINT, SIGINTHandler)

x = sensorObj.new_floatp()
y = sensorObj.new_floatp()
z = sensorObj.new_floatp()

# now output data every 250 milliseconds
while (1):
    sensor.update()

    sensor.getAccelerometer(x, y, z)
    print "Accelerometer x:", sensorObj.floatp_value(x),
    print " y:", sensorObj.floatp_value(y),
    print " z:", sensorObj.floatp_value(z),
    print " g"

    # we show both C and F for temperature
    print "Compensation Temperature:", sensor.getTemperature(), "C /",
    print sensor.getTemperature(True), "F"

    print
    time.sleep(.250)