1
-
2
1
Introduction
3
2
============
4
3
@@ -16,48 +15,67 @@ Introduction
16
15
17
16
I2C and SPI driver for the Bosch BME280 Temperature, Humidity, and Barometric Pressure sensor
18
17
19
- Dependencies
20
- =============
18
+ Installation and Dependencies
19
+ =============================
20
+
21
21
This driver depends on:
22
22
23
23
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython >`_
24
24
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice >`_
25
25
26
- Please ensure all dependencies are available on the CircuitPython filesystem.
27
- This is easily achieved by downloading
28
- `the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle >`_.
26
+ Please ensure that the driver and all dependencies are available on the
27
+ CircuitPython filesystem. This can be most easily achieved by downloading and
28
+ installing the latest
29
+ `Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle >`_
30
+ on your device.
31
+
32
+ Installing from PyPI
33
+ --------------------
34
+
35
+ On the Raspberry Pi, you can install the driver locally
36
+ `from PyPI <https://pypi.org/project/adafruit-circuitpython-bme280/ >`_. To
37
+ install system-wide, use:
38
+
39
+ ..code-block:: shell
40
+ pip3 install adafruit-circuitpython-bme280
41
+
42
+ To install in a virtual environment in your current project:
43
+
44
+ ..code-block:: shell
45
+ mkdir project-name && cd project-name
46
+ python3 -m venv .env
47
+ source .env/bin/activate
48
+ pip3 install adafruit-circuitpython-bme280
29
49
30
50
Usage Example
31
51
=============
32
52
33
53
.. code-block :: python
34
54
35
- import board
36
- import digitalio
37
- import busio
38
- import time
39
- import adafruit_bme280
40
-
41
- # Create library object using our Bus I2C port
42
- i2c = busio.I2C(board.SCL , board.SDA )
43
- bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
44
-
45
- # OR create library object using our Bus SPI port
46
- # spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
47
- # bme_cs = digitalio.DigitalInOut(board.D10)
48
- # bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, bme_cs)
55
+ import board
56
+ import digitalio
57
+ import busio
58
+ import time
59
+ import adafruit_bme280
49
60
50
- # change this to match the location's pressure (hPa) at sea level
51
- bme280.sea_level_pressure = 1013.25
61
+ # Create library object using our Bus I2C port
62
+ i2c = busio.I2C(board.SCL , board.SDA )
63
+ bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
52
64
53
- while True :
54
- print (" \n Temperature: %0.1f C" % bme280.temperature)
55
- print (" Humidity: %0.1f %% " % bme280.humidity)
56
- print (" Pressure: %0.1f hPa" % bme280.pressure)
57
- print (" Altitude = %0.2f meters" % bme280.altitude)
58
- time.sleep(2 )
65
+ # OR create library object using our Bus SPI port
66
+ # spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
67
+ # bme_cs = digitalio.DigitalInOut(board.D10)
68
+ # bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, bme_cs)
59
69
70
+ # change this to match the location's pressure (hPa) at sea level
71
+ bme280.sea_level_pressure = 1013.25
60
72
73
+ while True :
74
+ print (" \n Temperature: %0.1f C" % bme280.temperature)
75
+ print (" Humidity: %0.1f %% " % bme280.humidity)
76
+ print (" Pressure: %0.1f hPa" % bme280.pressure)
77
+ print (" Altitude = %0.2f meters" % bme280.altitude)
78
+ time.sleep(2 )
61
79
62
80
Contributing
63
81
============
@@ -66,7 +84,7 @@ Contributions are welcome! Please read our `Code of Conduct
66
84
<https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/master/CODE_OF_CONDUCT.md> `_
67
85
before contributing to help this project stay welcoming.
68
86
69
- Building locally
87
+ Building Locally
70
88
================
71
89
72
90
To build this library locally you'll need to install the
@@ -90,8 +108,8 @@ Then run the build:
90
108
91
109
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-veml6070 --library_location .
92
110
93
- Sphinx documentation
94
- -----------------------
111
+ Sphinx Documentation
112
+ --------------------
95
113
96
114
Sphinx is used to build the documentation based on rST files and comments in the code. First,
97
115
install dependencies (feel free to reuse the virtual environment from above):
0 commit comments