I have a Intel Arduino Genuino 101, i tried to implement the autoCalibrateAccelerometerOffset() function, through the code below on Arduino Genuino 101.
In a static test, without any stress or noise, I read the three axis value.
When I see the data on the serial monitor or on my file created with processing, the Z acceleration values jump from 1~0,99 to 0,00 g.
I think there is an error in my code
If i do a test, and i take the raw data the value are not correct, but stable. They don't change (1.13-1.16 is the range, but never 0)
Z is 1,15 and the resultant force is a little bit bigger than 1g, but stable.
I tried to implement the code even whitout connect Arduino 101 to Processing.
#include "SoftwareSerial.h"
#include "CurieIMU.h"
float sensorVals[] = {0,0,0};
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("Inizializzazione del device...");
CurieIMU.begin();
CurieIMU.setAccelerometerRange(2);
CurieIMU.autoCalibrateAccelerometerOffset(X_AXIS,0);
CurieIMU.autoCalibrateAccelerometerOffset(Y_AXIS,0);
CurieIMU.autoCalibrateAccelerometerOffset(Z_AXIS,1);
}
void loop() {
sensorVals[0] = CurieIMU.readAccelerometerScaled(0);
sensorVals[1] = CurieIMU.readAccelerometerScaled(1);
sensorVals[2] = CurieIMU.readAccelerometerScaled(2);
Serial.print(sensorVals[0]);
Serial.print(",");
Serial.print(sensorVals[1]);
Serial.print(",");
Serial.println(sensorVals[2]);
delay(100);
}
I asked on StackOverflow but i don't have a valid answer yet
Sorry for my bad english, i am improving day by day.
Thanks for your time and patience <3
ps i don't if this is the correct section or is more suitable for "Sensors" section