Created
September 22, 2012 11:37
-
-
Save KitWallace/3765893 to your computer and use it in GitHub Desktop.
Compass with declination correction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import time | |
from Devantech_CMPS10 import CMPS10 | |
compass = CMPS10() | |
declination = -2.2148 | |
while True : | |
magnetic_bearing= compass.bearing() | |
true_bearing = round((magnetic_bearing + declination) % 360,1) | |
print str(magnetic_bearing)+"M", str(true_bearing)+"T" | |
time.sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment