views:

173

answers:

2

I have to develop an application. Requirement is given below.

I have to put an indicator like speedometer in the bike.

iPhone is put in the corner of a Car.

The iPhone is in a placed in a car, from where it can't be dropped anywhere and can't be moved even. ( there is a special place in car where user place iPhone )

Now, Car is going on a smooth way.

Indicator indicates zero - that is smooth way.

Suppose, a bump is passed by the car.

These movement should be tracked by iPhone. If bump is huge,

  • iphone should display - huge bump - maximum indicator

If bump is low

  • iphone should display - normal bump - middle at indicator

else

  • iPhone should display - smooth road - zero indicator

I know how to add shake handler, as given in following link


http://stackoverflow.com/questions/1363935/accelerometer-range-in-iphone

But here iPhone is not going to be shake? It is in fixed place.

What should be the solution?

thanks for helping me in advance.

+3  A: 

The iPhone will be shaking - it's attached to the car, and the car will be shaking. You should be able to use the same code as you would if you were shaking it with your hand.

Andy Mikula
+5  A: 

You'll need to use the UIAccelerometer, UIAccelerometerDelegate, and UIAcceleration classes. Here is some Sample Code.

slf
and make sure to write same damn good filtering code for acc data
Johannes Rudolph
http://www.dspguide.com/ch14/5.htm
slf