accelerometer

Android/ iOS how to determine small changes in distance using sensors?

被刻印的时光 ゝ 提交于 2019-12-23 02:56:18
问题 I have been doing a bit of research, but I cannot seem to find a way to determine small distances (centimeters and meters) using the sensors in Android or iOS devices. Bluetooth appears too inaccurate and require more than one device, GPS only works over larger variations in distance, and small variations in rotation seem to make using the accelerometer nearly impossible. Is there a method that I am unaware of that would allow me to do such a thing? I am familiar with Calculus, so using

Phonegap Accelerometer y value to degrees

蹲街弑〆低调 提交于 2019-12-22 17:49:03
问题 Phonegap accelerometer seems to return y values as below: // +10 y axis = straight up = 0/360 deg // -10 y axis = straight down = 180 deg // flat y axis = 90/270 deg My question is, how do I convert this y axis to the given degrees? Also, as it's phonegap, I'm assuming these values are the same for all devices. if anyone knows otherwise please let me know. 回答1: Try this: deg = acceleration.y / 10 * 90; I think that worked for me when I was doing something similar. 来源: https://stackoverflow

How to calculate distance using accelerometer using iphone sdk?

梦想与她 提交于 2019-12-22 16:58:15
问题 What is the best way to calculate the distance between two points/Or we can say while we walk calculate distance traveled using accelerometer? My main question is that i'm working on an application in which i need to count distance using two locations but sometimes the core locations fails to update location so at that time how do i calculate the distance traveled? 回答1: You can't even get an accurate measurement of velocity from the accelerometer, so you're definitely not going to be able to

The method findViewById(int) is undefined for the type Get Data Fragment for Accelerometer Sensor

前提是你 提交于 2019-12-22 10:50:38
问题 I'm doing my project for getting data by acceleometer sensor in android platform. I'm having error codes in the 3 last line codes. Exactly the error is the findViewById is not for get data fragment. so, how I can use findviewbyId in Fragment for getting data accelerometer sensor?many thanks for the answer :) import android.app.Activity; import android.app.Fragment; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorManager; import android.os.Bundle;

class or interface expected

可紊 提交于 2019-12-22 07:45:32
问题 I used to use eclipse with android sdk but I just downloaded android studio. I wanted to use the accelerometer but for some reason I keep getting the same issue."Class or Interface expected" I am attaching the code below,if anyone can give me a solution to the problem, I will be obliged. package com.example.symbox.myapplication; import android.app.Activity; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware

Drawing in air with Android phone

有些话、适合烂在心里 提交于 2019-12-22 04:42:31
问题 I am working on an application to draw in the air with an android phone. As my phone is moving, thanks to the acceletometer, i retrieve the acceleration on each axis ax, ay, az. What I am interested in is: x,y,z. From what I read in forums and in some tutorials, integrating the accelaration twice gives huge errors. So what is the best solution for me to get information on the deplacement of the phone? Thanks for your help. 回答1: Not exactly what you are looking for: Store orientation to an

Objective C: Detecting a shake

我与影子孤独终老i 提交于 2019-12-22 03:50:48
问题 I'm using the shake api like this: - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if (event.subtype == UIEventSubtypeMotionShake) { [img stopAnimating]; } } How do I detect that the shaking has stopped? 回答1: You are on the right track, however, there are still more things you need to add to detect shaking: You can test this by adding an NSLog to the motionBegan or motionEnded methods, and in the Simulator, press CONTROL + COMMAND + Z #pragma mark - Shake Functions -

Finding distance using accelerometer in iPhone

蹲街弑〆低调 提交于 2019-12-22 01:42:53
问题 Please suggest some beginning point in this process of finding distance displaced by an iPhone. The requirement of accuracy in current system is in cm , and displacement can be in 3D. What I have already done is 1. Tried using sound to calculated distance between between 2 iPhones, but I need distance calculation with one iPhone only, i.e need displacement. 2. Tried CMMotionManager and its accelerometer data, but values received is helpless. I think I need a good filter to get useful data out

How do you release a shared accelerator instance on the iPhone?

…衆ロ難τιáo~ 提交于 2019-12-22 00:22:29
问题 I have created an accelerometer variable: UIAccelerometer *objAccelerometer; that I am associating to the sharedAccelerometer instance: objAccelerometer = [UIAccelerometer sharedAccelerometer]; objAccelerometer.delegate = self; When I release this view (to load a different view), the accelerometer instance causes the program to die. (If I have it commented out, I can switch between views without a problem). I had a similar problem with an NSTimer, but once I called: [myTimer invalidate];

Detect phone movement when screen is off

和自甴很熟 提交于 2019-12-22 00:09:42
问题 I am developing an application which should detect user movement and when he stops for more than 5 minutes it should sound an alarm. I was able to detect movement with accelerometer but the problem is it doesnt work when the screen is off. I have also tried using partial wakeLock. Re-registering accelerometer doesnt work either (this should be workaround for motorola devices). Maybe I can do this using GPS and sound an alarm when GPS speed is less than 1m/s for more than 5 minutes but I am