Simple test

Ensure your device works with this simple test.

examples/dps310_simpletest.py
import time
from machine import Pin, I2C
from micropython_dps310 import dps310

i2c = I2C(1, sda=Pin(2), scl=Pin(3))  # Correct I2C pins for RP2040
dps = dps310.DPS310(i2c)

while True:
    print(f"Pressure: {dps.pressure}HPa")
    print()
    time.sleep(1)

Temperature test

Example showing how to use the sensor temperture

examples/dps310_temperature.py
import time
from machine import Pin, I2C
from micropython_dps310 import dps310

i2c = I2C(1, sda=Pin(2), scl=Pin(3))  # Correct I2C pins for RP2040
dps = dps310.DPS310(i2c)

while True:
    print(f"Temperature {dps.temperature}°C")
    print()
    time.sleep(1)

Advanced Options

Example showing how to use the advanced options

examples/dps310_simpletest.py
import time
from machine import Pin, I2C
from micropython_dps310 import dps310

i2c = I2C(1, sda=Pin(2), scl=Pin(3))  # Correct I2C pins for RP2040
dps = dps310.DPS310(i2c)

while True:
    print(f"Pressure: {dps.pressure}HPa")
    print()
    time.sleep(1)