My CMPS10 was working fine for a while. When I was rewiring my system I accidentally wired the I2C pins to mode and factory use instead of the communication pins. Now the heading changes dramatically when the compass is tilted. The pitch and yaw functions still read out fine. Is the magnetometer damaged or did some software get scrambled? I tried resetting to factory specs but may have done it wrong. Here is the code I used:
void reset(){
Wire.beginTransmission(deviceId);
Wire.write(22);
delay(10);
Wire.write(0x20);
delay(100);
Wire.write(0x2A);
delay(100);
Wire.write(0x60);
Wire.endTransmission();
delay(100);
Serial.println("done");
}
This is running on an Arduino Mega with 5v power going to the compass. I've also got pull up resistors wired in to the I2C lines at the compass.
Thanks for any help you can provide.
