MPU6050 Arduino Due Problem


I made a code using arduino mega. It’s ok but when I try on arduino due I have a problem.

Below the code where I made a average (bias) of gyro and accel.

The problem is Gyro_raw_error_x average. See this

Arduino Mega
Gyro_raw_error_x = -3

Arduino Due
Gyro_raw_error_x = -2000

Other average values are very similar, but GyroX is not.

for(int j=0; j<=samples; j++)
      Wire.write(0x3B);                       //Ask for the 0x3B register- correspond to AcX
      Acc_rawX=(<<8| ; 
      Acc_rawY=(<<8| ;
      Acc_rawZ=(<<8| ;<<8|;<<8|;  <<8|;

      Acc_angle_error_x = Acc_angle_error_x + ((atan((Acc_rawY)/sqrt(pow((Acc_rawX),2) + pow((Acc_rawZ),2)))*rad_to_deg));
      Acc_angle_error_y = Acc_angle_error_y + ((atan(-1*(Acc_rawX)/sqrt(pow((Acc_rawY),2) + pow((Acc_rawZ),2)))*rad_to_deg)); 

      Gyro_raw_error_x = Gyro_raw_error_x + (Gyr_rawX/32.8); 
      Gyro_raw_error_y = Gyro_raw_error_y + (Gyr_rawY/32.8);      


Acc_angle_error_x = Acc_angle_error_x/samples;
Acc_angle_error_y = Acc_angle_error_y/samples;
Gyro_raw_error_x = Gyro_raw_error_x/samples;
Gyro_raw_error_y = Gyro_raw_error_y/samples;

Please do not double post.