Simple test

Ensure your device works with this simple test.

examples/mpl115a2_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import time
import board
import busio
import adafruit_mpl115a2

i2c = busio.I2C(board.SCL, board.SDA)

mpl = adafruit_mpl115a2.MPL115A2(i2c)

while True:
    print("Pressure: {}   Temperature: {}".format(mpl.pressure, mpl.temperature))
    time.sleep(1)