2015-03-21 10:00 PM
Dear all,
I am doing a project with the quadcopter. At this time, I can read the data of accelerometer ADXL345 exactly but the gyro sensor ITG3 I use I2C to communicate the sensors, and the results of ITG3200 changes over the time even it does not move. This is how I initialize the sensor, with the sampling rate is 100Hz.writeDevice(0xD0,0x15,0x09);//sample rate divider
writeDevice(0xD0,0x16,0x1B);//DLPF, Full scale
and this is how I read the data
data1 = RI2C(0x1D);
data2 = RI2C(0x1E);
data = (data2<<8)|data1;
Gx = data/375/100;
(Gx means the rotation around the x-axis, roll)
And the result is fluctuated a lot.
Could you have some ideas about this problem ?
Thank you so much.
My Skype ID is ngohoainguyen, you can contact to me if necessary.
2015-03-22 07:59 AM
I believe you swapped the high and low bytes. Try this:
data = (data1<<8) | data2; Cheers, Hal2015-03-23 07:55 PM