bme680.rst 1.59 KB
Newer Older
Rahix's avatar
Rahix committed
1
.. py:module:: bme680
chris007's avatar
chris007 committed
2

Rahix's avatar
Rahix committed
3
4
``bme680`` - Environmental Sensor
=================================
5
Allows access to environmental data of card10's surroundings.
chris007's avatar
chris007 committed
6

Rahix's avatar
Rahix committed
7
**Example**:
chris007's avatar
chris007 committed
8

Rahix's avatar
Rahix committed
9
.. code-block:: python
chris007's avatar
chris007 committed
10

Rahix's avatar
Rahix committed
11
   import bme680, utime
chris007's avatar
chris007 committed
12

13
14
15
   with bme680.Bme680() as environment:
       while True:
           d = environment.get_data()
chris007's avatar
chris007 committed
16

17
18
19
20
           print("Temperature:    {:10.2f} °C".format(d.temperature))
           print("Humidity:       {:10.2f} % r.h.".format(d.humidity))
           print("Pressure:       {:10.2f} hPa".format(d.pressure))
           print("Gas Resistance: {:10.2f} Ω".format(d.resistance))
chris007's avatar
chris007 committed
21

22
           utime.sleep(1)
Rahix's avatar
Rahix committed
23

24
25
26
27
28
29
30
31
32
33
34
Sensor Class
------------

.. autoclass:: bme680.Bme680
   :members:

Deprecated Interface
--------------------
The following functions should no longer be used directly.  The only exist for
compatibility as they were the old BME680 interface in previous firmware
versions.
Rahix's avatar
Rahix committed
35
36
37
38
39
40
41
42

.. py:function:: init()

   Initialize the sensor.

   Before being able to read data from the sensor, you have to call
   :py:func:`bme680.init`.

43
   .. versionadded:: 1.4
44
45
   .. deprecated:: 1.10
      Use the :py:class:`bme680.Bme680` class instead.
46

Rahix's avatar
Rahix committed
47
48
49
50
51
52
53
.. py:function:: get_data()

   Perform a single measurement of environmental data.

   :return: Tuple containing ``temperature`` (°C), ``humidity`` (% r.h.),
      ``pressure`` (hPa) and ``gas resistance`` (Ohm).

54
   .. versionadded:: 1.4
55
56
   .. deprecated:: 1.10
      Use the :py:class:`bme680.Bme680` class instead.
57

Rahix's avatar
Rahix committed
58
59
60
.. py:function:: deinit()

   Deinitialize the sensor.
61
62

   .. versionadded:: 1.4
63
64
   .. deprecated:: 1.10
      Use the :py:class:`bme680.Bme680` class instead.