Simple test¶
Ensure your device works with this simple test.
examples/mmr902_simpletest.py¶
import time
from machine import Pin, I2C
from micropython_mmr902 import mmr902
i2c = I2C(1, sda=Pin(2), scl=Pin(3)) # Correct I2C pins for RP2040
mmr = mmr902.MMR902(i2c)
while True:
print("Pressure: {}mmHg".format(mmr.pressure))
print("Temperature: {}C".format(mmr.temperature))
print()
time.sleep(0.5)
Operation mode settings¶
Example showing the Operation mode setting
examples/mmr902_operation_mode.py¶
import time
from machine import Pin, I2C
from micropython_mmr902 import mmr902
i2c = I2C(1, sda=Pin(2), scl=Pin(3)) # Correct I2C pins for RP2040
mmr = mmr902.MMR902(i2c)
mmr.operation_mode = mmr902.MODE1
while True:
for operation_mode in mmr902.operation_mode_values:
print("Current Operation mode setting: ", mmr.operation_mode)
for _ in range(10):
press = mmr.pressure
print("Temperature: {:.2f}mmHg".format(press))
print()
time.sleep(0.5)
mmr.operation_mode = operation_mode