Accelerometer data detection

Hi all,

I'm using an accelerometer to measure movement, mapping (0-100) and averaging the data fine. However, I'm looking to sense when the data goes from positive to negative. E.g. sensing when the X axis goes up from ...50,51,52 THEN stops and reverses (52,51,50...). How would I detect that that point when it reverses?

Thanks!

Differentiate the signal by subtracting the previous value from the current value. If the result is negative, the value is decreasing; if it's positive, the value is increasing.

You might want to apply some smoothing to the result so that you don't trip prematurely due to noise in the signal.

Thanks Peter.

How would you detect that the result is going negative or positive?

Sam

How would you detect that the result is going negative or positive?

Using some code that YOU add to the other code that you haven't posted. Enough questions until we see some code.