accelerometer

Get tilt angle from the android accelerometer

﹥>﹥吖頭↗ 提交于 2020-01-03 08:34:19
问题 I have a class that implements SensorEventListener and I would like to get the tilt Angle of my device using the Accelerometer . I looked for examples on the internet but they use Sensor.TYPE_MAGNETIC_FIELD . I believe my device doesn't have this sensor because when I do the following check manager.getSensorList(Sensor.TYPE_ACCELEROMETER).size() , I get zero . Is there a way to get the tilt Angle by just using Sensor.TYPE_ACCELEROMETER values? 回答1: As people suggested you can use the

background sensing of shake and GPS problems

旧街凉风 提交于 2020-01-03 05:20:59
问题 MainAcivity.java package com.example.background_shake; import java.util.List; import java.util.Locale; import android.app.Activity; import android.content.Intent; import android.hardware.SensorManager; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager; import android.widget.Button; public class MainActivity extends Activity implements

How to make a BLE mesh network?

爷,独闯天下 提交于 2020-01-03 04:51:31
问题 I had been wondering how wireless earbuds work and came across this image. I do not know how to replicate what is shown in the following image and would like to learn how to do it. My end goal is to be able to have the smartphone connect to a device, while still being able to play music to a Bluetooth Headphone. I read into BLE 4.1 mesh and I am not sure if that would help either. I have made images for the possible ways the multiple devices could communicate but I don't have enough

Android listactivity scrolling with accelerometer issue

夙愿已清 提交于 2020-01-03 04:28:07
问题 I have a ListActivity in my android application that works perfectly. Until I decided to add scrolling capabilities by using the accelerometer. Here's my code: package be.pxl.minecraftguide; import android.app.ListActivity; import android.content.ContentResolver; import android.database.Cursor; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.support

Detect horizontal and vertical movement of the Smartphone on a table

混江龙づ霸主 提交于 2020-01-03 03:39:06
问题 I'm trying to write a small android game where the phone is placed on the table. On the screen there is a ball, which the user control its movement by moving the phone. Along all the game the user won't lift the phone from the table. At the beginning the ball will placed in the middle of the screen: Pushing the phone from the user: should move the ball toward the top of the smartphone screen: And from the current position of the ball, moving the phone back to the user, and to the right: will

Android accelerometer sampling rate/delay stabilization

て烟熏妆下的殇ゞ 提交于 2020-01-03 03:27:06
问题 I'm trying to detect the force strength of a tap by using the data from the accelerometer and with the method onTouch. As far as I know, the fastest sampling frequency for the accelerometer is 200-202Hz, but this variability is giving me problems when trying to match the timestamps for the onTouch event and the peak in the accelerometer data. Is there a way to stabilize the readings of the accelerometer to avoid this problem? Like controlling the specific thread or something? 回答1: If you want

Keep iOS App Awake To Monitor Movement

僤鯓⒐⒋嵵緔 提交于 2020-01-03 02:54:06
问题 I'm having trouble getting the main feature of my iOS application to work. I'm trying to create an app that measures the amount of movement over a period of a few hours using CoreMotion. All works fine when the device is awake, however the issue is that the device auto locks after a while and enters the background state, thus my methods for monitoring movement pause. I'm searching for a possible solution to recording the device's movement whilst it has been locked, which may be to keep the

How to decrease SPI overhead time for STM32L4 HAL library

邮差的信 提交于 2020-01-02 07:00:10
问题 I am using a STM32L476RG board and HAL SPI functions: HAL_SPI_Transmit(&hspi2, &ReadAddr, 1, HAL_MAX_DELAY); HAL_SPI_Receive(&hspi2, pBuffer, 4, HAL_MAX_DELAY); I need to receive data from accelerometer's buffer with maximum speed and I have a problem with delay in these functions. As you can see on the oscilloscope screenshots, there are several microseconds during which nothing happens. I have no idea how to minimize the transmission gap. I tried using HAL_SPI_Receive_DMA function and this

Kalman filter and quality of internal state variables

扶醉桌前 提交于 2020-01-02 03:17:28
问题 I am trying to develop motion detection application for Android. App should be able to track motion of phone in space and map it to motion on computer screen. I am using 3-axis accelerometer and since data is very noisy I am using Kalman filter. Internal state is 6 component vector [speed-x, speed-y, speed-z, accel-x, accel-y, accel-z] and measured state is 3 component vector [accel-x, accel-y, accel-z]. Filter works very well on measured values, but speed is still very noisy. Now I am

Position calculation of small model of a car using Accelerometer + Gyroscope

天涯浪子 提交于 2020-01-01 19:22:17
问题 I wish to calculate position of a small remote controlled car (relative to starting position). The car moves on a flat surface for example: a room floor. Now, I am using an accelerometer and a gyroscope. To be precise this board --> http://www.sparkfun.com/products/9623 As a first step I just took the accelerometer data in x and y axes (since car moves on a surface) and double integrated the data to get position. The formulae I used were: vel_new = vel_old + ( acc_old + ( (acc_new - acc_old )