Simple test
Ensure your device works with this simple test.
examples/mlx90614_simpletest.py
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4# Designed specifically to work with the MLX90614 sensors in the
5# adafruit shop
6# ----> https://www.adafruit.com/product/1747
7# ----> https://www.adafruit.com/product/1748
8#
9# These sensors use I2C to communicate, 2 pins are required to
10# interface Adafruit invests time and resources providing this open
11# source code,
12# please support Adafruit and open-source hardware by purchasing
13# products from Adafruit!
14
15import board
16
17import adafruit_mlx90614
18
19# The MLX90614 only works at the default I2C bus speed of 100kHz.
20# A higher speed, such as 400kHz, will not work.
21i2c = board.I2C() # uses board.SCL and board.SDA
22# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
23mlx = adafruit_mlx90614.MLX90614(i2c)
24
25# temperature results in celsius
26print("Ambent Temp: ", mlx.ambient_temperature)
27print("Object Temp: ", mlx.object_temperature)