-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from jposada202020/adding_temp
adding temperature reading
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SPDX-FileCopyrightText: 2023 Jose D. Montoya | ||
# SPDX-License-Identifier: MIT | ||
|
||
import time | ||
import board | ||
import adafruit_mlx90393 | ||
|
||
i2c = board.I2C() # uses board.SCL and board.SDA | ||
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller | ||
SENSOR = adafruit_mlx90393.MLX90393(i2c, gain=adafruit_mlx90393.GAIN_1X) | ||
|
||
|
||
while True: | ||
temp = SENSOR.temperature | ||
|
||
print("Temperature: {} °C".format(temp)) | ||
|
||
# Display the status field if an error occurred, etc. | ||
if SENSOR.last_status > adafruit_mlx90393.STATUS_OK: | ||
SENSOR.display_status() | ||
time.sleep(1.0) |