Skip to content

Commit 69904fd

Browse files
committed
example!
1 parent 67b1714 commit 69904fd

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.rst

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,32 @@ This is easily achieved by downloading
2626
Usage Example
2727
=============
2828

29-
TODO
29+
.. code-block:: python
30+
import gc
31+
from busio import I2C
32+
import adafruit_bme680
33+
import time
34+
import board
35+
36+
gc.collect()
37+
print("Free mem:",gc.mem_free())
38+
39+
# Create library object using our Bus I2C port
40+
i2c = I2C(board.SCL, board.SDA)
41+
bme280 = adafruit_bme680.Adafruit_BME680_I2C(i2c)
42+
43+
# change this to match the location's pressure (hPa) at sea level
44+
bme280.seaLevelhPa = 1013.25
45+
46+
while True:
47+
print("\nTemperature: %0.1f C" % bme280.temperature)
48+
print("Gas: %d ohm" % bme280.gas)
49+
print("Humidity: %0.1f %%" % bme280.humidity)
50+
print("Pressure: %0.1f hPa" % bme280.pressure)
51+
print("Altitude = %0.2f meters" % bme280.altitude)
52+
53+
time.sleep(2)
54+
3055
3156
Contributing
3257
============

0 commit comments

Comments
 (0)