Simple test

Ensure your device works with this simple test.

examples/pct2075_high_temp_alert_example.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4import time
 5import board
 6import adafruit_pct2075
 7
 8i2c = board.I2C()  # uses board.SCL and board.SDA
 9# i2c = board.STEMMA_I2C()  # For using the built-in STEMMA QT connector on a microcontroller
10pct = adafruit_pct2075.PCT2075(i2c)
11
12pct.high_temperature_threshold = 35.5
13pct.temperature_hysteresis = 30.0
14pct.high_temp_active_high = False
15print("High temp alert active high? %s" % pct.high_temp_active_high)
16
17# Attach an LED with the Cathode to the INT pin and Anode to 3.3V with a current limiting resistor
18
19while True:
20    print("Temperature: %.2f C" % pct.temperature)
21    time.sleep(0.5)

High temperature alert example

Shows a basic example on how to use the high temperature alert mode

examples/pct2075_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4import time
 5import board
 6import adafruit_pct2075
 7
 8i2c = board.I2C()  # uses board.SCL and board.SDA
 9# i2c = board.STEMMA_I2C()  # For using the built-in STEMMA QT connector on a microcontroller
10pct = adafruit_pct2075.PCT2075(i2c)
11
12while True:
13    print("Temperature: %.2f C" % pct.temperature)
14    time.sleep(0.5)