AP_Compass_test - added display to auto detected compass
git-svn-id: https://arducopter.googlecode.com/svn/trunk@2716 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
parent
1158e35945
commit
fd2547216d
@ -27,11 +27,27 @@ void setup()
|
|||||||
Wire.begin();
|
Wire.begin();
|
||||||
compass.init(); // Initialization
|
compass.init(); // Initialization
|
||||||
|
|
||||||
compass.set_orientation(AP_COMPASS_COMPONENTS_UP_PINS_FORWARD); // set compass's orientation on aircraft. If using HMC5883L, AP_COMPASS_HMC5883L_COMPONENTS_UP_PINS_FORWARD
|
compass.set_orientation(AP_COMPASS_COMPONENTS_DOWN_PINS_FORWARD); // set compass's orientation on aircraft.
|
||||||
compass.set_offsets(0,0,0); // set offsets to account for surrounding interference
|
compass.set_offsets(0,0,0); // set offsets to account for surrounding interference
|
||||||
compass.set_declination(ToRad(0.0)); // set local difference between magnetic north and true north
|
compass.set_declination(ToRad(0.0)); // set local difference between magnetic north and true north
|
||||||
|
|
||||||
delay(1000);
|
Serial.print("Compass auto-detected as: ");
|
||||||
|
switch( compass.product_id ) {
|
||||||
|
case AP_COMPASS_TYPE_HIL:
|
||||||
|
Serial.println("HIL");
|
||||||
|
break;
|
||||||
|
case AP_COMPASS_TYPE_HMC5843:
|
||||||
|
Serial.println("HMC5843");
|
||||||
|
break;
|
||||||
|
case AP_COMPASS_TYPE_HMC5883L:
|
||||||
|
Serial.println("HMC5883L");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Serial.println("unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(3000);
|
||||||
timer = millis();
|
timer = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user