mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 09:21:12 +03:00
bmm150: split into new library, C port, FTI, C++ wraps C
Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
#!/usr/bin/python
|
||||
# Author: Jon Trulson <jtrulson@ics.com>
|
||||
# Copyright (c) 2016 Intel Corporation.
|
||||
# Copyright (c) 2016-2017 Intel Corporation.
|
||||
#
|
||||
# The MIT License
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
@ -23,7 +25,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
import time, sys, signal, atexit
|
||||
from upm import pyupm_bmx055 as sensorObj
|
||||
from upm import pyupm_bmm150 as sensorObj
|
||||
|
||||
def main():
|
||||
# Instantiate a BMP250E instance using default i2c bus and address
|
||||
@ -46,18 +48,14 @@ def main():
|
||||
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), end=' ')
|
||||
print(" y:", sensorObj.floatp_value(y), end=' ')
|
||||
print(" z:", sensorObj.floatp_value(z), end=' ')
|
||||
data = sensor.getMagnetometer()
|
||||
print("Magnetometer x:", data[0], end=' ')
|
||||
print(" y:", data[1], end=' ')
|
||||
print(" z:", data[2], end=' ')
|
||||
print(" uT")
|
||||
|
||||
print()
|
||||
|
Reference in New Issue
Block a user