Mprls simpletest

#include <Adafruit_MPRLS.h>
#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);
}

After I upload this code it says the following errors:

Arduino: 1.8.19 (Mac OS X), Board: "Adafruit Trinket (ATtiny85 @ 8MHz)"

In file included from /Users/ncm/Documents/Arduino/mprls_simpletest_1/mprls_simpletest_1.ino:25:0:
/Users/ncm/Documents/Arduino/libraries/Adafruit_MPRLS_Library/Adafruit_MPRLS.h:45:7: error: redefinition of 'class Adafruit_MPRLS'
 class Adafruit_MPRLS {
       ^~~~~~~~~~~~~~
In file included from /Users/ncm/Documents/Arduino/mprls_simpletest_1/mprls_simpletest_1.ino:1:0:
/Users/ncm/Documents/Arduino/libraries/Adafruit_MPRLS_Library/Adafruit_MPRLS.h:45:7: note: previous definition of 'class Adafruit_MPRLS'
 class Adafruit_MPRLS {
       ^~~~~~~~~~~~~~
/Users/ncm/Documents/Arduino/mprls_simpletest_1/mprls_simpletest_1.ino: In function 'void setup()':
mprls_simpletest_1:33:3: error: 'Serial' was not declared in this scope
   Serial.begin(9600);
   ^~~~~~
/Users/ncm/Documents/Arduino/mprls_simpletest_1/mprls_simpletest_1.ino:33:3: note: suggested alternative: 'Stream'
   Serial.begin(9600);
   ^~~~~~
   Stream
/Users/ncm/Documents/Arduino/mprls_simpletest_1/mprls_simpletest_1.ino: In function 'void loop()':
mprls_simpletest_1:47:3: error: 'Serial' was not declared in this scope
   Serial.print("Pressure (hPa): ");
   ^~~~~~
/Users/ncm/Documents/Arduino/mprls_simpletest_1/mprls_simpletest_1.ino:47:3: note: suggested alternative: 'Stream'
   Serial.print("Pressure (hPa): ");
   ^~~~~~
   Stream
Multiple libraries were found for "Wire.h"
 Used: /Users/ncm/Library/Arduino15/packages/adafruit/hardware/avr/1.4.15/libraries/Wire
 Not used: /private/var/folders/jd/_8cc0_tx6_l2bx84h5kw8k1m0000gn/T/AppTranslocation/095CFED5-C84A-4746-BC7B-271AE1EC8222/d/Arduino 2.app/Contents/Java/hardware/arduino/avr/libraries/Wire
exit status 1
'Serial' was not declared in this scope

What Arduino board?

Read the forum guidelines to see how to properly post code and some information on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please go back and fix your original post by highlighting the code and clicking the </> in the menu bar.
code tags new

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.