File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,18 @@ def _read_temperature(self):
104
104
self ._t_fine = int (var1 + var2 )
105
105
#print("t_fine: ", self.t_fine)
106
106
107
+ @property
108
+ def dew_point (self ):
109
+ # pylint: disable=invalid-name
110
+ # Disable: c is a constant used in the Magnus formula
111
+ """The dew point in Celsius using the Magnus formula. Constants from Sontag, 1990."""
112
+ b = 17.62
113
+ c = 243.12
114
+ gamma = (b * self .temperature / (c + self .temperature )) + math .log (self .humidity / 100.0 )
115
+ dewpoint = (c * gamma ) / (b - gamma )
116
+ return dewpoint
117
+ # pylint: enable=invalid-name
118
+
107
119
@property
108
120
def temperature (self ):
109
121
"""The compensated temperature in degrees celsius."""
Original file line number Diff line number Diff line change 9
9
bme280 = adafruit_bme280 .Adafruit_BME280_I2C (i2c )
10
10
11
11
# OR create library object using our Bus SPI port
12
- #spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
13
- #bme_cs = digitalio.DigitalInOut(board.D10 )
14
- #bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, bme_cs)
12
+ # spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
13
+ # bme_cs = digitalio.DigitalInOut(board.D5 )
14
+ # bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, bme_cs)
15
15
16
16
# change this to match the location's pressure (hPa) at sea level
17
17
bme280 .sea_level_pressure = 1013.25
21
21
print ("Humidity: %0.1f %%" % bme280 .humidity )
22
22
print ("Pressure: %0.1f hPa" % bme280 .pressure )
23
23
print ("Altitude = %0.2f meters" % bme280 .altitude )
24
+ print ("Dew point = %0.1f C" % bme280 .dew_point )
24
25
time .sleep (2 )
You can’t perform that action at this time.
0 commit comments