How we use the clock?

I try to detect a lack of moov with an accerelometre during 30 seconds so I have to take a clock but my script don’t worck.

What ‘don’t worck’ Erwan? The Clock does not start the Accelerometer or the Clock is not turning the Accelerometer off after thirty seconds?

To start the Accelerometer , set Enabled to true; to stop it after 30 seconds set Enabled to false.

Here is some example code:

that might be what you want to do…

Regards,
Steve

When I fall, my application syop and i can’t detect a no moov (acceleration<1.962 during 30 seconds). I think it’s a problem of the clock but i’m not sure.
I hope, you can help me
Erwan

  1. I think the inability to detect movement is an issue of how you programmed your code Erwan. I guess your use of conditional statements (If else if…) is the problem. Unfortunately we can not tell from the incomplete code you posted. I expect you will have better success using only the accelerometer x and y axis measurements (ignore the z axis which measures gravity) and you might have a better result.

  2. This discussion ( OrientationSensor Pitch movement (or how to use Accelerometer to detect movement) ) is about a developer making a similar app . The developer uses an orientation, then an accelerometer and finally decides that the best tool is a gyroscope. The discussion might help you to debug your code.

Regards,
Steve

I think it’s not a problem of the conditional statement because when i take off the clock, my application has no problem but with the clock all my screem is frozen and i can’t do anything.
Erwan

screen, sorry for the mistake

Attachedis an app that detects movement using the Accelerometer over a period of 30 seconds. It was tested with the Android resting on a desk (yields Patient Not Moving) and also by slightly moving the Android (yields Patient is Moving)

inProgress

moving

Sensitivity is set to 1 on my Tablet. You can vary the sensitivity to movement by experimenting with this value.

Press start and let the Clock count up to 30. When it reaches 30, it will let you know if there is detected movement or not.

Perhaps this example will help you to fix your code Erwan.
AccelerometerTimed.aia (3.9 KB)

Try it. It might do what you want.

What is the interval of your clock? Maybe it is too short.
It would really help if you posted an English version of your blocks (just switch the language to English in the drop down meno, top right).
And a more complete version. Maybe an .aia?
Cheers, Ghica

The interval of my clock is 1000 and for detect a lack of moov the accelerometre has to be less than 1.962(0.2g).
Thanks Steve for your script but it’s not exactly that i want, so I am editing.
V02_accelerometre3.aia (6.3 KB)

1 Like