Simple test¶
Ensure your device works with this simple test.
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
16import adafruit_mlx90614
17
18# The MLX90614 only works at the default I2C bus speed of 100kHz.
19# A higher speed, such as 400kHz, will not work.
20i2c = board.I2C()
21mlx = adafruit_mlx90614.MLX90614(i2c)
22
23# temperature results in celsius
24print("Ambent Temp: ", mlx.ambient_temperature)
25print("Object Temp: ", mlx.object_temperature)