File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ import time
2
+ import board
3
+ import digitalio
4
+ from busio import SPI
5
+ import adafruit_bme680
6
+
7
+ # Create library object using our Bus SPI port
8
+ cs = digitalio .DigitalInOut (board .D10 )
9
+ spi = SPI (board .SCK , MOSI = board .MOSI , MISO = board .MISO )
10
+ bme680 = adafruit_bme680 .Adafruit_BME680_SPI (spi , cs )
11
+
12
+ # change this to match the location's pressure (hPa) at sea level
13
+ bme680 .sea_level_pressure = 1013.25
14
+
15
+ # You will usually have to add an offset to account for the temperature of
16
+ # the sensor. This is usually around 5 degrees but varies by use. Use a
17
+ # separate temperature sensor to calibrate this one.
18
+ temperature_offset = - 5
19
+
20
+ while True :
21
+ print ("\n Temperature: %0.1f C" % (bme680 .temperature + temperature_offset ))
22
+ print ("Gas: %d ohm" % bme680 .gas )
23
+ print ("Humidity: %0.1f %%" % bme680 .relative_humidity )
24
+ print ("Pressure: %0.3f hPa" % bme680 .pressure )
25
+ print ("Altitude = %0.2f meters" % bme680 .altitude )
26
+
27
+ time .sleep (1 )
You can’t perform that action at this time.
0 commit comments