Skip to content

Commit a38d296

Browse files
authored
Merge pull request #19 from jposada202020/improving_docs
improving_docs
2 parents ffe6a94 + c9dc851 commit a38d296

File tree

3 files changed

+37
-16
lines changed

3 files changed

+37
-16
lines changed

adafruit_mlx90614.py

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
**Software and Dependencies:**
3535
3636
* Adafruit CircuitPython firmware for the supported boards:
37-
https://github.com/adafruit/circuitpython/releases
37+
https://circuitpython.org/downloads
3838
"""
3939

4040
from micropython import const
@@ -72,14 +72,37 @@
7272

7373

7474
class MLX90614:
75-
"""Create an instance of the MLX90614 temperature sensor. You must pass in
76-
the following parameters:
77-
- i2c: An instance of the I2C bus connected to the sensor.
78-
- frequency=100000 - this sensor does not respond to the default 400000 i2c bus speed
75+
"""Create an instance of the MLX90614 temperature sensor.
7976
80-
Optionally you can specify:
81-
- address: The I2C address of the sensor.
82-
If not specified the sensor's default value will be assumed."""
77+
:param ~busio.I2C i2c_bus: The I2C bus the MLX90614 is connected to.
78+
Do not use an I2C bus speed of 400kHz. The sensor only works
79+
at the default bus speed of 100kHz.
80+
:param int address: I2C device address. Defaults to :const:`0x5A`.
81+
82+
**Quickstart: Importing and using the MLX90614**
83+
84+
Here is an example of using the :class:`MLX90614` class.
85+
First you will need to import the libraries to use the sensor
86+
87+
.. code-block:: python
88+
89+
import board
90+
import adafruit_mlx90614
91+
92+
Once this is done you can define your `board.I2C` object and define your sensor object
93+
94+
.. code-block:: python
95+
96+
i2c = board.I2C()
97+
mlx = adafruit_mlx90614.MLX90614(i2c)
98+
99+
Now you have access to the :attr:`ambient_temperature` attribute
100+
101+
.. code-block:: python
102+
103+
temperature = mlx.ambient_temperature
104+
105+
"""
83106

84107
def __init__(self, i2c_bus, address=_MLX90614_I2CADDR):
85108
self._device = i2c_device.I2CDevice(i2c_bus, address)
@@ -88,12 +111,12 @@ def __init__(self, i2c_bus, address=_MLX90614_I2CADDR):
88111

89112
@property
90113
def ambient_temperature(self):
91-
"""Ambient Temperature in celsius."""
114+
"""Ambient Temperature in Celsius."""
92115
return self._read_temp(_MLX90614_TA)
93116

94117
@property
95118
def object_temperature(self):
96-
"""Object Temperature in celsius."""
119+
"""Object Temperature in Celsius."""
97120
return self._read_temp(_MLX90614_TOBJ1)
98121

99122
def _read_temp(self, register):

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26-
https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/DIY_Thermal_Light_Painting
26+
Using Melexis MLX90614 Non-Contact Sensors Learning Guide <https://learn.adafruit.com/using-melexis-mlx90614-non-contact-sensors>
2727

2828
.. toctree::
2929
:caption: Related Products

examples/mlx90614_simpletest.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313
# products from Adafruit!
1414

1515
import board
16-
import busio as io
1716
import adafruit_mlx90614
1817

19-
# the mlx90614 must be run at 100k [normal speed]
20-
# i2c default mode is is 400k [full speed]
21-
# the mlx90614 will not appear at the default 400k speed
22-
i2c = io.I2C(board.SCL, board.SDA, frequency=100000)
18+
# The MLX90614 only works at the default I2C bus speed of 100kHz.
19+
# A higher speed, such as 400kHz, will not work.
20+
i2c = board.I2C()
2321
mlx = adafruit_mlx90614.MLX90614(i2c)
2422

2523
# temperature results in celsius

0 commit comments

Comments
 (0)