I’m using the accelerometer of the dIMU Sensor and i have some problems on the reading when i use this code: #pragma config(Sensor, S2, DIMU, sensorI2CCustomFastSkipStates) #include “drivers/dexterind-imu.h”
float x,y,z;
task main()
{
if (!DIMUconfigAccel(DIMU, DIMU_ACC_RANGE_2G))
PlaySound(soundException);
while(1){
DIMUreadAccelAxes10Bit(DIMU, x, y, z);
wait10Msec(1);
}
}
When I set up the program with the robot placed paralel to the floor the value of the y is 0, but if i set up the program with the robot placed perpendicular to the floor when i put the robot paralel to the floor the value of y isn’t 0, is 0,5, and i want that the accelerometer give me the same values when is in the same site no matter in wich position i set up the program, anyone can help? i will be very gateful.
I didn’t find a solution, i just put the sensor on the floor and I execute this line when is on the floor:
if (!DIMUconfigAccel(DIMU, DIMU_ACC_RANGE_2G))
PlaySound(soundException);
Then i put the sensor in the robot and i start the program. This works but i dont like to put the sensor on the floor every time i want to start the program. Can you give me the link of the example program for calibrating? Thank you for answering.