Particle Boron with MMA8451

I am using Boron to measure position and acceleration using MMA8451 sensor.
First Scenario: I just use the example program given in particle.It reads the value from the sensor and directly prints through Serial port. It works perfectly and I am able to get all the values somewhat accurate.

Second Scenario: I store the data in sensor buffer. I get the value from sensor every two seconds(put boron to sleep for 2 seconds). Store it in the array which I created in Boron. Once the size of the array filled reaches a threshold value like 900 or 1000. I print all the values at once through Serial port.
In this scenario, I am getting negative maxed out values periodically like below.
-8160;-8160;-8160;-19.536686;-19.536686;-19.536686
-8160;-8160;-8160;-19.536686;-19.536686;-19.536686
-8160;-8160;-8160;-19.536686;-19.536686;-19.536686
-44;162;4052;-0.107739;0.392649;9.691729
-44;163;4053;-0.107739;0.395043;9.689334
-46;162;4052;-0.102951;0.392649;9.698911
-42;166;4048;-0.110133;0.387861;9.698911
Can you please let me know what might be the reason??

It’s impossible to say without seeing your code.

2 Likes