Skip to content

Commit 11e16fd

Browse files
committed
add pypi instructions to README.rst
1 parent 2f0c5ae commit 11e16fd

File tree

1 file changed

+49
-31
lines changed

1 file changed

+49
-31
lines changed

README.rst

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Introduction
32
============
43

@@ -16,48 +15,67 @@ Introduction
1615

1716
I2C and SPI driver for the Bosch BME280 Temperature, Humidity, and Barometric Pressure sensor
1817

19-
Dependencies
20-
=============
18+
Installation and Dependencies
19+
=============================
20+
2121
This driver depends on:
2222

2323
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
2424
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
2525

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
2949

3050
Usage Example
3151
=============
3252

3353
.. code-block:: python
3454
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
4960
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)
5264
53-
while True:
54-
print("\nTemperature: %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)
5969
70+
# change this to match the location's pressure (hPa) at sea level
71+
bme280.sea_level_pressure = 1013.25
6072
73+
while True:
74+
print("\nTemperature: %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)
6179
6280
Contributing
6381
============
@@ -66,7 +84,7 @@ Contributions are welcome! Please read our `Code of Conduct
6684
<https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/master/CODE_OF_CONDUCT.md>`_
6785
before contributing to help this project stay welcoming.
6886

69-
Building locally
87+
Building Locally
7088
================
7189

7290
To build this library locally you'll need to install the
@@ -90,8 +108,8 @@ Then run the build:
90108
91109
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-veml6070 --library_location .
92110
93-
Sphinx documentation
94-
-----------------------
111+
Sphinx Documentation
112+
--------------------
95113

96114
Sphinx is used to build the documentation based on rST files and comments in the code. First,
97115
install dependencies (feel free to reuse the virtual environment from above):

0 commit comments

Comments
 (0)