Genuino101CurieIMUGyro

Bu öğretici ile jiroskop ham değerlerini okumayı ve üç eksenin her birinin etrafında açısal bir hıza dönüştürmeyi öğrenirsiniz. Bu bilgi, üç eksen etrafındaki dönme hareketini ölçmek için yararlıdır; bu, hareketin sürekli olması durumunda hızlanmanın ölçemediği bir şeydir.

Gerekli Donanım

Devre


Bu öğreticiyi kullanmak için ek donanıma gerek yoktur.

Yazılım Temelleri

Kütüphaneler

CurieIMU .h, 101 anakartın IMU yongasının tüm parametrelerine, özelliklerine ve okumalarına erişim sağlayan kütüphanedir. Bu ünite üç eksenli ivmeölçer ve üç eksenli jiroskop içerir. Bu kütüphane 101 kart çekirdeğinin bir parçasıdır ve Arduino veya Genuino 101 için çekirdek dosyalarla birlikte yüklenir. Bu derste ham cayro değerlerini okuyoruz.

Fonksiyonlar

floG convertRawGyro (int gRaw) - jiroskoptan (gRaw) okunan ham verileri saniyede derece (° / s) olarak ifade edilen bir değere dönüştürür. İşlevin formülü, setGyroRange ile ayarlanan jiroskop aralığına uyacak şekilde ayarlanmalıdır.

Kod

/*
 * Copyright (c) 2016 Intel Corporation.  All rights reserved.
 * See the bottom of this file for the license terms.
 */


/*
   This sketch example demonstrates how the BMI160 on the
   Intel(R) Curie(TM) module can be used to read gyroscope data
*/


#include "CurieIMU.h"

void setup() {
  Serial.begin(9600); // initialize Serial communication
  while (!Serial);    // wait for the serial port to open

  // initialize device
  Serial.println("Initializing IMU device...");
  CurieIMU.begin();

  // Set the accelerometer range to 250 degrees/second
  CurieIMU.setGyroRange(250);
}

void loop() {
  float gx, gy, gz; //scaled Gyro values

  // read gyro measurements from device, scaled to the configured range
  CurieIMU.readGyroScaled(gx, gy, gz);

  // display tab-separated gyro x/y/z values
  Serial.print("g:\t");
  Serial.print(gx);
  Serial.print("\t");
  Serial.print(gy);
  Serial.print("\t");
  Serial.print(gz);
  Serial.println();
}

/*
   Copyright (c) 2016 Intel Corporation.  All rights reserved.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

*/
[Kodu Al]

See Also