forked from jloosli/Adafruit-Raspberry-Pi-Python-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
30 lines (23 loc) · 996 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
from Adafruit_MPL115A2 import MPL115A2
# ===========================================================================
# Example Code
# ===========================================================================
# Initialise the BMP085 and use STANDARD mode (default value)
# bmp = BMP085(0x77, debug=True)
mpl = MPL115A2(0x60, debug=True)
# To specify a different operating mode, uncomment one of the following:
# bmp = BMP085(0x77, 0) # ULTRALOWPOWER Mode
# bmp = BMP085(0x77, 1) # STANDARD Mode
# bmp = BMP085(0x77, 2) # HIRES Mode
# bmp = BMP085(0x77, 3) # ULTRAHIRES Mode
temp, pressure, temp2 = mpl.getPT()
# temp = mpl.readTemperature()
# pressure = mpl.readPressure()
# altitude = mpl.readAltitude()
print "Temperature: %.2f C" % temp
print "Temperature: %.2f F" % (temp * 9 / 5 + 32)
print "Temperature: %.2f C" % temp2
print "Temperature: %.2f F" % (temp2 * 9 / 5 + 32)
print "Pressure: %.2f hPa" % (pressure / 100.0)
#print "Altitude: %.2f" % altitude