sensor

getSensorList() vs. getDefaultSensor() in Android SensorManager

假装没事ソ 提交于 2019-12-13 13:15:53
问题 I'm writing a game for Android and want to be able to use the accelerometer for input. I see two ways of getting a sensor, one way is to use the first element of SensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER) and the other is SensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) . The getDefaultSensor doc says it could return a "composite" sensor, so if I want a "raw" sensor I should use getSensorList . Any idea what the difference between a composite or raw sensor is? Does this

How do DHT22 and gpio's work?

痞子三分冷 提交于 2019-12-13 08:56:58
问题 I just got myself a sensor DHT22 for temperature and humidity and I have some doubts: - Is this device only usable with arduino or Rpi? - If the answer is No, how does it work with the GPIO? As far as I understand, gpio has2 options: -Direcion (in or out) and Value (0 or 1). So according to this, I was checking a lot of examples for arduino and Rpi on how to use this devices, and all are attached to gpio's port. So how is this working? Does c/c++ has bigger capacity to handle this readings? -

android values upload database with json

*爱你&永不变心* 提交于 2019-12-13 08:56:21
问题 I created MAGNETIC_FIELD sensor. this code giving x y z event values, ArithmeticAvg and SQRTx^2+y^2+z^2 i have to upload database these values. how can i upload database these values with json or something else. here my code public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_main); SensingTextView tv = new SensingTextView(this); SensorManager sm =

How to cause my C++ program to wait for sensor events for ever and not terminate

僤鯓⒐⒋嵵緔 提交于 2019-12-13 02:37:28
问题 I'm trying to write a simple C++ app that registers to Windows sensor events. I followed the MSDN documentaion and managed succesfully to get notifications when sensor events occur, my problem is that my main function ends, and so does the application. How to i cuase it to wait forever for events to occur? Currently it registers and dies... I have the following code: My main looks like this: int _tmain(int argc, _TCHAR* argv[]) { RegisterToSensorEvents(); return 0; } void

How to slow down android sensor events

拥有回忆 提交于 2019-12-13 02:14:01
问题 I'm trying to detect motion of an android device and taking linear acceleration values from the device. I'm using the SensorEvent's timestamp and comparing it against the last update time to determine whether to log the sensor value or not. But it's having no effect whatsoever. Why isn't it working? @Override public void onSensorChanged(SensorEvent event) { if(event.sensor.getType() == Sensor.TYPE_LINEAR_ACCELERATION) { int value = (int) event.values[0]; if(actualTime - lastUpdate > 5000) {

Get velocity from 3DVector using accelerometer sensor

十年热恋 提交于 2019-12-12 22:16:32
问题 I was wondering if I can calculate the velocity of the phone using accelerometer sensor. What I mean is someone swing the phone once and I can measure velocity or force which was used to do this... or any other which can tell how powerful swing was:D After playing with accelerometer for a while(in VS and emulator) I see it works a little different that I though. Is it possible to achieve something like this? 回答1: No, not accurately. Although my previous answer here is about position, the same

Should i use Accelerometer or Gyroscope to measure angle of the z-axis

偶尔善良 提交于 2019-12-12 12:29:51
问题 I am writing an An app in Android that needs to know the angle the rear camera is pointing with respect to the horizon and not with respect to it's last position. All of the definitions i have read for the compass and accelerometer don't say that i can do this. Is it at all possible to do this ? 回答1: You should use the Accelerometer. The idea is the following, in a static camera, the only force (which is seen by the accelerometer) acting on the camera is gravity. This should be able to give

Android gravity sensor (TYPE_GRAVITY) for 2.1

痞子三分冷 提交于 2019-12-12 09:57:09
问题 I have software designed for 2.3.3 where I am using the gravity sensor. Code below - private SensorManager sman = (SensorManager) getContext().getSystemService(Context.SENSOR_SERVICE); private Sensor magnetfield, gravity; ... magnetfield = sman.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); gravity = sman.getDefaultSensor(Sensor.TYPE_GRAVITY); I decided to add support for version 2.1. However it seems TYPE_GRAVITY is not supported in 2.1, and I get an error that Sensor.TYPE_GRAVITY is not

yamaha MS-3C sensor on samsung galaxy

会有一股神秘感。 提交于 2019-12-12 09:24:52
问题 I have a samsung galaxy s and i have made an application that make a list of sensor in the phone. That program show me many sensor, but my question is on two of them: MS-3C Magnetic sensor -->type:2 MS-3C Orientation sensor -->type:3 why it say that they are two different sensor? in the sheet of yamaha http://www.yamaha.co.jp/english/product/lsi/magnetic_sensor/ it seems to be a single sensor. Why android report it as two different sensor? it use the same chip to give me two type of data?

Android Orientation sensor for rotation the 3D cube

久未见 提交于 2019-12-12 09:05:10
问题 I'm trying to make 3-dof controller using Android phone, similar to Wiimote. Uses Accelerometer for recognizing the controller's orientation (used getOrientation() method for calculation) I'm testing the orientation values by using those values to rotate the cube drawn by opengl in PC. The problem is, it doesn't seem working. If the phone is rotated over the specific rotation, the cube is rotated to some weird direction. Without knowledge of computer graphics, I found the reference saying