raspberrypi:mpu9250
girsokopas, akselorometras ir kompasas MPU9250. ir dar kartu su barometru ir termometru BMP280
viskas sudeta viename modulyje: GY-91
https://github.com/FaBoPlatform/FaBo9AXIS-MPU9250-Python
pip install FaBo9Axis_MPU9250
# coding: utf-8 ## @package faboMPU9250 # This is a library for the FaBo 9AXIS I2C Brick. # # http://fabo.io/202.html # # Released under APACHE LICENSE, VERSION 2.0 # # http://www.apache.org/licenses/ # # FaBo <[email protected]> import FaBo9Axis_MPU9250 import time import sys import os mpu9250 = FaBo9Axis_MPU9250.MPU9250() try: while True: os.system('clear') accel = mpu9250.readAccel() print " ax = " , ( accel['x'] ) print " ay = " , ( accel['y'] ) print " az = " , ( accel['z'] ) gyro = mpu9250.readGyro() print " gx = " , ( gyro['x'] ) print " gy = " , ( gyro['y'] ) print " gz = " , ( gyro['z'] ) mag = mpu9250.readMagnet() print " mx = " , ( mag['x'] ) print " my = " , ( mag['y'] ) print " mz = " , ( mag['z'] ) print time.sleep(0.2) except KeyboardInterrupt: sys.exit()
raspberrypi/mpu9250.txt · Last modified: by aistis

