sensor

Using orientation sensor to point towards a specific location

拥有回忆 提交于 2019-12-17 17:58:29
问题 I'm trying to implement an arrow that uses the orientation sensor in order to point towards a specific location. Google Places implements this arrow in a ListView for each place it finds. I've managed to get the azimuth, but given a location, I don't know how to proceed to calculate the angle I need. Moreover, I need to make the conversions from real north and magnetic north. Does anybody have an example of such implementation? Thanks in advance. 回答1: I solved it. float azimuth = // get

How to use onSensorChanged sensor data in combination with OpenGL

好久不见. 提交于 2019-12-17 17:25:06
问题 ( edit: I added the best working approach in my augmented reality framework and now also take the gyroscope into account which makes it much more stable again: DroidAR framework ) I have written a TestSuite to find out how to calculate the rotation angles from the data you get in SensorEventListener.onSensorChanged() . I really hope you can complete my solution to help people who will have the same problems like me. Here is the code, I think you will understand it after reading it. Feel free

Is there a way to retrieve multiple sensor data in Android

若如初见. 提交于 2019-12-17 10:32:47
问题 I'm trying to get both accelerometer and orientation data. Currently, I created an AccelerometerManager and OrientationManager. They both do the same thing; implement SensorEventListener and retrieve data from values[] in onSensorChanged() listeners. Is there an easier way to do this? It seems like having 2 handlers with duplicate code is uneccessary. Is there a way to access a values[] array with the combined accelerometer and orientation data together? Because of the 2 handlers, I'm also

iPhone Proximity Sensor

无人久伴 提交于 2019-12-17 08:30:30
问题 Can the iPhone SDK take advantage of the iPhone's proximity sensors? If so, why hasn't anyone taken advantage of them? I could picture a few decent uses. For example, in a racing game, you could put your finger on the proximity sensor to go instead of taking up screen real-estate with your thumb. Of course though, if this was your only option, then iPod touch users wouldn't be able to use the application. Does the proximity sensor tell how close you are, or just that something is in front of

Android TYPE_LINEAR_ACCELERATION sensor - what does it show?

回眸只為那壹抹淺笑 提交于 2019-12-17 03:55:16
问题 I am developing application for car acceleration tracking. I used standard accelerometer, calibrating it in specific position beforehand. Then, assuming phone's orientation is not changing, I logged the accelerometer data for a specified time and calculated move parameters, one of which is the car's speed at the end of the test. It works rather well, on a straight, horizontal road: error of a few percent. But then I found out, that in API-level 10 there is a virtual sensor called TYPE_LINEAR

How do I rectify this error: “newline” is invalid keyword argument for this function

前提是你 提交于 2019-12-14 04:23:38
问题 I'm currently working with raspberry pi and using DHT11 to read temperature and humidity values every second. I have to save these values into a database in real time. Here's my code that showing sensor data every second. import RPi.GPIO as GPIO import dht11 import time import datetime import csv import os # initialize GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.cleanup() instance = dht11.DHT11(pin=dht11_pin) with open('file_name.csv', 'w', newline='') as csvfile: field_names = [

How to save sensor data output into Microsoft access using python

余生长醉 提交于 2019-12-14 04:21:42
问题 I'm currently working with raspberry pi and using DHT11 to read temperature and humidity values every second. I have to save these values into a database in real time. Here's my code that showing sensor data every second. I don't know how to save the data/result in Microsoft Access. import RPi.GPIO as GPIO import dht11 import time import datetime import os # initialize GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.cleanup() instance = dht11.DHT11(pin=dht11_pin) while True: cnt += 1

atmel sensor using printf

徘徊边缘 提交于 2019-12-13 17:41:16
问题 I'm learning embedded system. I have a atmel UC3-L0 and compass sensor. Now I install AtmelStudio and download some demo code into the board. But I have no idea where the function "printf" in demo code will appear the data. How should I do to get the data? 回答1: In order to use printf in ATMEL studio you should check the following things: Add and Apply the Standard serial I/O module from Project->ASF Wizard. Also add the USART module from the ASF Wizard. Include the following code snippet

How to make two way platform box2d body?

妖精的绣舞 提交于 2019-12-13 16:26:18
问题 I have created platform using box2d. I want box2d body detect and not detect dynamically. Box2d shapes will do the followings Detect collision on some condition Not detect collision on some condition Both condition will work on different condition in same box2d object. Any idea would help a lot. Thanks in advance. 回答1: There are several ways to control what happens when a collision occurs in Box2d. The first thing to do is read this article and decide on what way you want to control it. That

Why enum values for some sensors are missing from <android/sensor.h>? Is it safe to use them?

江枫思渺然 提交于 2019-12-13 14:38:22
问题 It seems that enum values for some sensors are missing from <android/sensor.h> . The file defines following enum: /* * Sensor types * (keep in sync with hardware/sensor.h) */ enum { ASENSOR_TYPE_ACCELEROMETER = 1, ASENSOR_TYPE_MAGNETIC_FIELD = 2, ASENSOR_TYPE_GYROSCOPE = 4, ASENSOR_TYPE_LIGHT = 5, ASENSOR_TYPE_PROXIMITY = 8 }; The comment says that this enum is synced with <hardware/sensor.h> (which is not exposed, it's a part of android source). But in the <hardware/sensor.h> I've found