当前位置:   article > 正文

android 陀螺仪源码,陀螺仪源码 android

sh3001陀螺仪源码

发表于 2015-12-03 07:47:55 by 月小升

package com.toplus.speedtest;

import java.util.Locale;

import com.toplus.speedtest.R;

import android.app.ActionBar;

import android.app.Activity;

import android.app.FragmentTransaction;

import android.hardware.Sensor;

import android.hardware.SensorEvent;

import android.hardware.SensorEventListener;

import android.hardware.SensorManager;

import android.os.Bundle;

import android.support.v4.app.Fragment;

import android.support.v4.app.FragmentActivity;

import android.support.v4.app.FragmentManager;

import android.support.v4.app.FragmentPagerAdapter;

import android.support.v4.app.NavUtils;

import android.support.v4.view.ViewPager;

import android.view.Gravity;

import android.view.LayoutInflater;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

import android.view.ViewGroup;

import android.widget.TextView;

import android.widget.Toast;

public class MainActivity extends Activity implements SensorEventListener

{

private SensorManager sm;

private Sensor mGyroscope;

private Sensor mAccelerator;

private Sensor GAccelerator;

private TextView axis_x = null ,axis_y = null ,axis_z = null;

private TextView axis_x_degree = null, axis_y_degree = null, axis_z_degree = null ;

private TextView G_axis_x = null ,G_axis_y = null ,G_axis_z = null;

private TextView axis_gro_x_degree = null;// ,G_axis_y = null ,G_axis_z = null;

private double X_max=0, Y_max=0, Z_max=0;

public static final double G_CONSTANT = 9.81;

private double degree_X = 0 , offset_X = 0 ;

private double degree_Y = 0 , offset_Y = 0 ;

private double degree_Z = 0 , offset_Z = 0 ;

private long lasttimestamp=0;

private TextView R_total = null ;

private static final double C= 180 / Math.PI / 1000000000;

private static final float NS2S = 1.0f / 1000000000.0f;

private final float[] deltaRotationVector = new float[4];

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/746232
推荐阅读
相关标签
  

闽ICP备14008679号