Hi,
I know this product is already obsolete, I’m just wondering if I can still get some tech support on this.
I am actually comparing two different sensors for motion control operation so I would like their sample rate to be identical. The other sensor I have can sample at about 200Hz and faster. According to the datasheet of L3G4200D and LSM303DLH, I know they can support the same sample rate too. However according to the arduino sample sketch, the main loop only runs at 50Hz, which is shown below:
void loop() //Main Loop
{
if((millis()-timer)>=20) // Main loop runs at 50Hz
{
counter++;
timer_old = timer;
timer=millis();
if (timer>timer_old)
G_Dt = (timer-timer_old)/1000.0; // Real time of loop run. We use this on the DCM algorithm (gyro integration time)
else
G_Dt = 0;
// *** DCM algorithm
// Data adquisition
Read_Gyro(); // This read gyro data
Read_Accel(); // Read I2C accelerometer
if (counter > 5) // Read compass data at 10Hz... (5 loop runs)
{
counter=0;
Read_Compass(); // Read I2C magnetometer
Compass_Heading(); // Calculate magnetic heading
}
// Calculations...
Matrix_update();
Normalize();
Drift_correction();
Euler_angles();
// ***
printdata();
}
}
How do I change the loop so I can print out data at faster rate?
Thanks,
Dao.