Adafruit BMP388 Board Arduino Code Error

I am trying to upload Adafruit's BMP388 test code and I am getting an error (Error compiling for board Arduino Uno). I can upload other codes to the uno but this code doesn't work. Am I missing something?

Maybe, but we are missing your code and the full error message.

Don't forget the code tags

Check this out: How to get the best out of this forum - Using Arduino / Installation & Troubleshooting - Arduino Forum

Your question needs code, schematics, and complete error messages. Then people should be able help.

Your post was MOVED to its current location as it is more suitable.


Processing: bmp3xx_simpletest.ino...

Please use that cunningly names "Copy error messages" button in the IDE to do what it says and then post your code and the error messages here in code tags as described in How to get the best out of this forum

/***************************************************************************
  This is a library for the BMP3XX temperature & pressure sensor

  Designed specifically to work with the Adafruit BMP388 Breakout
  ----> http://www.adafruit.com/products/3966

  These sensors use I2C or SPI to communicate, 2 or 4 pins are required
  to interface.

  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 & Kevin Townsend for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ***************************************************************************/

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BMP3XX.h"

#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 11
#define BMP_CS 10

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BMP3XX bmp;

void setup() {
  Serial.begin(115200);
  while (!Serial);
  Serial.println("Adafruit BMP388 / BMP390 test");

  if (!bmp.begin_I2C()) {   // hardware I2C mode, can pass in address & alt Wire
    //if (! bmp.begin_SPI(BMP_CS)) {  // hardware SPI mode
    //if (! bmp.begin_SPI(BMP_CS, BMP_SCK, BMP_MISO, BMP_MOSI)) {  // software SPI mode
    Serial.println("Could not find a valid BMP3 sensor, check wiring!");
    while (1);
  }

  // Set up oversampling and filter initialization
  bmp.setTemperatureOversampling(BMP3_OVERSAMPLING_8X);
  bmp.setPressureOversampling(BMP3_OVERSAMPLING_4X);
  bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
  bmp.setOutputDataRate(BMP3_ODR_50_HZ);
}

void loop() {
  if (! bmp.performReading()) {
    Serial.println("Failed to perform reading :(");
    return;
  }
  Serial.print("Temperature = ");
  Serial.print(bmp.temperature);
  Serial.println(" *C");

  Serial.print("Pressure = ");
  Serial.print(bmp.pressure / 100.0);
  Serial.println(" hPa");

  Serial.print("Approx. Altitude = ");
  Serial.print(bmp.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println(" m");

  Serial.println();
  delay(2000);
}

Arduino: 1.8.13 (Windows 10), Board: "Arduino Uno"

Multiple libraries were found for "Adafruit_BMP3XX.h"

In file included from C:\Users\Owner\Downloads\Adafruit_BMP3XX-master\Adafruit_BMP3XX-master\examples\bmp3xx_simpletest\bmp3xx_simpletest.ino:21:0:

Used: C:\Users\Owner\Documents\Arduino\libraries\Adafruit_BMP3XX-master

C:\Users\Owner\Documents\Arduino\libraries\Adafruit_BMP3XX-master/Adafruit_BMP3XX.h:27:10: fatal error: Adafruit_I2CDevice.h: No such file or directory

Not used: C:\Users\Owner\Documents\Arduino\libraries\Adafruit_BMP3XX_Library

#include <Adafruit_I2CDevice.h>

Multiple libraries were found for "Adafruit_Sensor.h"

      ^~~~~~~~~~~~~~~~~~~~~~

Used: C:\Users\Owner\Documents\Arduino\libraries\Adafruit_Sensor-master

compilation terminated.

Not used: C:\Users\Owner\Documents\Arduino\libraries\Adafruit_Unified_Sensor

exit status 1

Error compiling for board Arduino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Have you got this library installed ?

I installed both libraries that Adafruit says to install ( adafruit bmp3xx & Adafruit Unified Sensor)

How did you you install them ?

Through the manage libraries tab in Arduino IDE

In my experience the Adafruit libraries are good at installing dependant libraries when using the Library Manager but the Adafruit_I2CDevice library appears not to be available in the Library Manager but you can download it from here https://github.com/adafruit/Adafruit_BusIO by the look of it

1 Like

Thanks, that worked.