1

我正在创建一个简单的应用程序,它根据加速度计执行某些操作。目前,如果我在 -z 方向上足够快地移动它,它就会启动这些东西。我的目标是做到这一点,这样如果我在桌子上点击手机两次,它就会执行任务。手机将正面朝上,因此手机背面将“撞击”桌子两次。我想要的设置是,如果表中“强”足够的点击在一秒钟内发生,它将执行任务。因此,一次点击的设置不是问题,但对我来说,让它只有在给定的时间限制内发生两次时才响应它。

在此之前非常感谢!

4

1 回答 1

1

Depending on the accelerometer you have you either have to sense two peaks within a reasonable, and separated by, the latency time interval, or you can get the hardware to detect a double pulse in the axis you wish. I'm looking at the spec of the MMA7455L, which can do double pulse. If you hardware doesn't do it, you can just sample the acceleration in measurement mode, or even easier set the device to level mode and wait for the interrupts on the threshold you specify.

于 2013-07-05T11:43:59.600 回答