accelerometer

Can anyone tell me whether gravity sensor is as a tilt sensor to improve heading accuracy?

给你一囗甜甜゛ 提交于 2019-12-11 18:55:06
问题 X and Y axis of magnetometer can be used to calculate the heading of north when phone is level to the local ground. But when rolling or pitching the phone, we should use roll and pitch degree to eliminate the tilt error. Now, I want to know whether the gravity sensor is used as tilt sensor to get the roll and pitch to help improve the accuracy of heading to the north? 回答1: Here I describe how to get the orientation of the device with respect to the horizontal plane and the magnetic North. It

Pushing accelerometer data into an array

笑着哭i 提交于 2019-12-11 16:24:46
问题 I'm having trouble recording the Z-axis data from the accelerometer in an array. I think I'm probably failing on some basic java rules, but here's what I'm trying to do: private ArrayList<Float[]> z = new ArrayList<Float[]>(); protected void onCreate(Bundle savedInstanceState) { SensorManager manager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); Sensor accelerometer = manager .getDefaultSensor(Sensor.TYPE_ACCELEROMETER); } public void onSensorChanged(SensorEvent event) { float x

ADXL345 Device ID and offset being wrong (Raspberry Pi)

泪湿孤枕 提交于 2019-12-11 14:16:25
问题 Currently using 3 Raspberry Pi's. Each one of them should be able to collect x, y and z with an accelerometer. However a problem is occuring when I run the following script on my newest Raspberry Pi: #!/usr/bin/python # -*- coding: utf-8 -*- # Example on how to read the ADXL345 accelerometer. # Kim H. Rasmussen, 2014 import sys, math, os, spidev, datetime, ftplib # Setup SPI spi = spidev.SpiDev() #spi.mode = 3 <-- Important: Do not do this! Or SPI won't work as intended, or even at all. spi

Accelerometer - Crashing after shaken - Cocoa Touch

这一生的挚爱 提交于 2019-12-11 13:43:08
问题 Hello I'm trying to have it, so once the user shakes the device. I want a sound to play. However once I shake the device it crashes, this is the code which I have used - (BOOL)canBecomeFirstResponder { return YES; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self becomeFirstResponder]; } - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if(motion == UIEventSubtypeMotionShake) { NSString *path = [[NSBundle mainBundle] pathForResource:@"sound"

Accelerometer seems to only work for a few seconds?

爱⌒轻易说出口 提交于 2019-12-11 11:30:02
问题 With this in the Android Manifest: <receiver android:name=".OnBootReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.QUICKBOOT_POWERON" /> </intent-filter> </receiver> And the following as OnBootReceiver.class: package io.cordova.hellocordova; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.hardware.Sensor; import android.hardware

Android Accelerometer setup: can I get it to run only when button it pressed.

白昼怎懂夜的黑 提交于 2019-12-11 06:54:32
问题 I am using an Accelerometer in my application and I am wondering if I can make it the way that accelerometer is only activates for a certain amount of time after the user has pressed a start button. It should stops when user press the stop button. It will essentially work as a pedometer which is part of a bigger application. This is the code used to implement the accelerometer:- SensorManager sensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); int sensorType = Sensor.TYPE

How can I get notified on accelerometer changes?

天大地大妈咪最大 提交于 2019-12-11 06:49:35
问题 I work on a magic eight ball style application. What is the easiest way to simply add a listener to the accelerometer, and when it changes a decent amount (being shaken), to have something trigger? 回答1: Here is my code for accelerometer i have require accelerometer play sound clip..... I have "gavel_single.wav" ring in asset folder......Its work properly I also send some references... http://developer.android.com/resources/samples/AccelerometerPlay/index.html my code import android.app

Accelerometer not changing values

有些话、适合烂在心里 提交于 2019-12-11 05:30:02
问题 So I have the code below which I can't get to work. I am trying to have one class (AccelerometerReader) read the values of my phone's accelerometer, and then I call those values in another class (MyGame), which I use to print those values on the screen. Everything in the code seems fine, and I don't get any values, except the values that I print all just say 0.0, and don't change. I know for a fact my phone has an accelerometer too. Any help would be appreciated! Thanks, Owen

unity 3d rotate the gameobject according to accelerometer

走远了吗. 提交于 2019-12-11 04:51:09
问题 I want to make a game like temple run. I need to rotate the platform of my player according to the how much I tilt the device. I am trying the accelerometer but I could not get the game object tilted. Please guide me. Thanks This is my code I was using the code in comments previously now im trying to use the code out of the comments public class tilt : MonoBehaviour { Vector3 dir; float movespeed; bool istilt; // Use this for initialization void Start () { dir=Vector3.zero; movespeed=10.0f;

How to detect one full turn (360 degrees) of the phone?

回眸只為那壹抹淺笑 提交于 2019-12-11 04:47:23
问题 Since I did not find any relevant answers searching the web, I am posting a question regarding detection of 360 degrees turns of android devices around its axes using the accelerometer. For example around y-axis in landscape mode: let us say that in starting position y value is 0 (device is flat to ground). When phone is rotated forward for 90 degrees y = -10 , 180 degrees forward tilt would result in y = 0 , 270 degrees tilt in y = +10 and 360 degrees in y = 0 . So how would the code look