Adafruit MPRLS Ported Pressure Sensor Breakout - Code error

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
twobitebrownies
 
Posts: 1
Joined: Wed Aug 11, 2021 10:00 am

Adafruit MPRLS Ported Pressure Sensor Breakout - Code error

Post by twobitebrownies »

Hi,

I am trying to use the Adafruit MPRLS Ported Pressure Sensor Breakout with an Arduino Uno. Following the Adafruit setup instructions (https://learn.adafruit.com/adafruit-mpr ... duino-test), I ran the simpletest file from the Adafruit MPRLS Library. However, when looking at the serial monitor, it only prints the line "MPRLS Simple Test" two times. It does not even print "Failed to communicate with MPRLS sensor, check wiring?" or "MPRLS Sensor Found". which means it is getting stuck in the if statement of the code. However, I am not sure why this is. Does anyone have any insight?

A picture of the serial output is attached.

For reference, here is the code from mprls_simpletest:

Code: Select all

/*!
 * @file mprls_simpletest.ino
 *
 * A basic test of the sensor with default settings
 * 
 * Designed specifically to work with the MPRLS sensor from Adafruit
 * ----> https://www.adafruit.com/products/3965
 *
 * These sensors use I2C to communicate, 2 pins (SCL+SDA) are required
 * to interface with the breakout.
 *
 * Adafruit invests time and resources providing this open source code,
 * please support Adafruit and open-source hardware by purchasing
 * products from Adafruit!
 *
 * Written by Limor Fried/Ladyada for Adafruit Industries.  
 *
 * MIT license, all text here must be included in any redistribution.
 *
 */
 
#include <Wire.h>
#include "Adafruit_MPRLS.h"

// You dont *need* a reset and EOC pin for most uses, so we set to -1 and don't connect
#define RESET_PIN  -1  // set to any GPIO pin # to hard-reset on begin()
#define EOC_PIN    -1  // set to any GPIO pin to read end-of-conversion by pin
Adafruit_MPRLS mpr = Adafruit_MPRLS(RESET_PIN, EOC_PIN);

void setup() {
  Serial.begin(115200);
  Serial.println("MPRLS Simple Test");                    
  if (! mpr.begin()) {
    Serial.println("Failed to communicate with MPRLS sensor, check wiring?");
    while (1) {
      delay(10);
    }
  }
  Serial.println("Found MPRLS sensor");
}


void loop() {
  float pressure_hPa = mpr.readPressure();
  Serial.print("Pressure (hPa): "); Serial.println(pressure_hPa);
  Serial.print("Pressure (PSI): "); Serial.println(pressure_hPa / 68.947572932);
  delay(1000);
}
Thanks all.
Attachments
mprls_serial.PNG
mprls_serial.PNG (10.36 KiB) Viewed 483 times

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit MPRLS Ported Pressure Sensor Breakout - Code er

Post by adafruit_support_bill »

Please post a photo showing your soldering and connections.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”