34
34
**Software and Dependencies:**
35
35
36
36
* Adafruit CircuitPython firmware for the supported boards:
37
- https://github.com/adafruit/circuitpython/releases
37
+ https://circuitpython.org/downloads
38
38
"""
39
39
40
40
from micropython import const
72
72
73
73
74
74
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.
79
76
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
+ """
83
106
84
107
def __init__ (self , i2c_bus , address = _MLX90614_I2CADDR ):
85
108
self ._device = i2c_device .I2CDevice (i2c_bus , address )
@@ -88,12 +111,12 @@ def __init__(self, i2c_bus, address=_MLX90614_I2CADDR):
88
111
89
112
@property
90
113
def ambient_temperature (self ):
91
- """Ambient Temperature in celsius ."""
114
+ """Ambient Temperature in Celsius ."""
92
115
return self ._read_temp (_MLX90614_TA )
93
116
94
117
@property
95
118
def object_temperature (self ):
96
- """Object Temperature in celsius ."""
119
+ """Object Temperature in Celsius ."""
97
120
return self ._read_temp (_MLX90614_TOBJ1 )
98
121
99
122
def _read_temp (self , register ):
0 commit comments