Skip to content

Commit 457b4d0

Browse files
author
KTOWN
committed
More accurate altitude calculations
1 parent 6ce7476 commit 457b4d0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Adafruit_BMP085/Adafruit_BMP085_example.py

+10
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,19 @@
1717
# bmp = BMP085(0x77, 3) # ULTRAHIRES Mode
1818

1919
temp = bmp.readTemperature()
20+
21+
# Read the current barometric pressure level
2022
pressure = bmp.readPressure()
23+
24+
# To calculate altitude based on an estimated mean sea level pressure
25+
# (1013.25 hPa) call the function as follows, but this won't be very accurate
2126
altitude = bmp.readAltitude()
2227

28+
# To specify a more accurate altitude, enter the correct mean sea level
29+
# pressure level. For example, if the current pressure level is 1023.50 hPa
30+
# enter 102350 since we include two decimal places in the integer value
31+
# altitude = bmp.readAltitude(102350)
32+
2333
print "Temperature: %.2f C" % temp
2434
print "Pressure: %.2f hPa" % (pressure / 100.0)
2535
print "Altitude: %.2f" % altitude

0 commit comments

Comments
 (0)