accelerometer

C++ “was not declared in this scope” compile error and modification tips.

I'm trying to modify this code in an attempt to make it work on an Arduino Mega. I'm pretty much new to C so, I may have made some major mistakes. By the way, this is for a self balancing skateboard. :P This code is taken from an ATmega32 (from : [url=http://sites.google.com/site/onewheeledselfbalancing/Home/twin-wheel-self-balancing-sk...

What are the major differences between coding an AVR ATmega32 and an Arduino Mega?

I'm trying to modify this code in an attempt to make it work on an Arduino Mega. I'm pretty much new to C, so I may have made some major mistakes. By the way, this is for a self balancing skateboard. This code is taken from an ATmega32 (from here) and I'm trying to make it work on a Arduino Mega. This code was written for an ATmega32 ...

Measuring velocity via iPhone SDK

I need to implement a native iPhone app to measure the velocity of the phone (basically a speedometer). I know that you can do so via the CoreLocation API fairly easily, but I am concerned about battery consumption since this is to be a real-time measurement that could be used for up to a couple of hours at a time. My understanding is ...

How can I detect a shake gesture in PhoneGap 0.8?

I'm using PhoneGap 0.8 and I'd like to detect a basic shake gesture. I've found two relevant snippets: http://groups.google.com/group/phonegap/browse_thread/thread/25178468b8eb9e9f http://phonegap.pbworks.com/Handling-Shake-Events Neither of them are working for me. Unfortunately the documentation seems a little outdated and the API r...

Preventing sleep in Titanium for iPhone

I'm trying to read the accelerometer for a longer period of time (between one and two hours). However, when the iPhone goes to sleep and locks, the reading of the accelerometer readout is paused. My setInterval timer seems to be running fine though. I can also play sounds. I see two solutions a) Find a way to read the acceleromete...

Iphone-SDK: accelerometer x,z to 360 degrees?

How is it possible to take the x,z values produced by the accelerometer and translate it as values that will represent a point in 360 degrees of the iphone rotation? (LANDSCAPED) it can be -2 to 2 (0 for the middle point) and it can be 0 to 360, as long as it represents a value for the whole iphone rotation. I need it for a Landscape ga...

Accelerometer detecting side to side movements

Hi there, can someone please give me an example of how you detect if the iphone is moving left or moving right. like a long version of a shake i want my app to be able to know if the users arm is going right or left. imagine your hand like a window wiper with the phone at the end any ideas? Thanks, Sam :P ...

Detect the iPhone rotation spin?

Hello all, I want to create an application could detect the number of spin when user rotates the iPhone device. Currently, I am using the Compass API to get the angle and try many ways to detect spin. Below is the list of solutions that I've tried: 1/ Create 2 angle traps (piece on the full round) on the full round to detect whether the...

iPhone Accelerometer calibration

How do I properly calibrate the accelerometer for my iPhone game? Currently, when the phone is on a flat surface, the paddle drifts to the left. High or Low Pass filters are not an acceptable solution as I need complete control over the paddle even at low & high values. I know Apple has the BubbleLevel sample but I find it difficult to f...

Simulating the accelerometer event feature in Firefox 3.6?

I just downloaded Firefox 3.6 today and I noticed in the list of new features they have an Orientation API that can detect the direction that your laptop/computer is tilted. This is clearly a hardware feature of some sort; So if you don't have the hardware to do so is there any way of simulating it so that you can test it out on your pr...

How to calculate distance using accelerometer using iphone sdk?

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 calc...

How to Count the Number of Steps Using the Accelerometer

hi i want to know how to calculate steps taken using the Accelerometer. Actually i calculate acceleration and use this code to count step length = sqrt(x * x + y * y + z * z); if(length>=2){ stepcount+=1; } where length calculate acceleration using acceleration.x, acceleration.y,acceleration.z But my main problem at starting the a...

Accelerometer stops delivering samples when the screen is off on Droid/Nexus One even with a WakeLock

I have some code that extends a service and records onSensorChanged(SensorEvent event) accelerometer sensor readings on Android. I would like to be able to record these sensor readings even when the device is off (I'm careful with battery life and it's made obvious when it's running). While the screen is on the logging works fine on a 2....

Is there a Snow Leopard compatible "sudden motion sensor" API available?

I have been using Unimotion in my application to read motion sensor values for Apple laptops, but have been unable to port the code to 10.6 64-bit. (I have also tried SMSLib and had the no luck either.) Is there any simple 10.6 compatible SMS API? If there is no alternative, I am also considering patching one of the libraries. Both U...

How can I access the accelerometer properly in Android 1.5?

I have seen a few code examples of 1.0 / 1.1 but since a lot of that is deprecated now I was hoping to find a nice 1.5+ example. I have some code here that I wrote but it doesn't really work properly. Any help would be great, thanks! public class collectAccel extends Activity implements SensorEventListener, ...

How do you use a moving average to filter out accelerometer values in iPhone OS

I want to filter the accelerometer values using a moving average, how is this done? Thanks ...

How to program smooth movement with the accelerometer like a labyrinth game on iPhone OS?

I want to be able to make image move realistically with the accelerometer controlling it, like any labyrinth game. Below shows what I have so far but it seems very jittery and isnt realistic at all. The ball images seems to never be able to stop and does lots of jittery movements around everywhere. - (void)accelerometer:(UIAccelerometer...

Detecting the iPhone Device is flat

To detect the orientation of the phone when taking a picture I use orientation == UIDeviceOrientationLandscapeRight orientation == UIDeviceOrientationPortraitUpsideDown orientation == UIDeviceOrientationPortrait orientation == UIDeviceOrientationLandscapeLeft But these work if the picture is being taken from the side. How do I check ...

Is it possible to run accelerometer of iPhone in background?

I want to use accelerometer of iPhone to get the log file of accelerometer value (maybe for 24 hours). Is it possible to let accelerometer runs in background while other applications are running? ...

maximal acceleration of UIAccelerometer

Hi, i want to track how fast my iPhone is moved. i checked the AceelerometerGraph Example App, where the maximum Amount was about 2.0 (in this app) i want to know how exactly i can track the speed of my moving iphone. in this example app the maximum amount is reached very fast. Is there a way to get better results ? Sry for my bad en...