Adafruit_BMP280.h: No such file or directory

I've been trying to solve this problem for 2 hours now. I installed all the necessary libraries:
C:\Users\kerey\OneDrive\Documents\Arduino\libraries

  • Adafruit_BMP280_Library
  • Adafruit_BusIO
  • Adafruit_Unified_Sensor

Code:

#include <WiFi.h>
#include <WiFiUdp.h>
#include <Adafruit_BMP280.h>

// Константы BMP280
#define SDA_PIN 21
#define SCL_PIN 22
#define BMP280_ADDRESS 0x76
// Библиотека BMP280
Adafruit_BMP280 bmp280;

// Давление на уровне моря (по умолчанию)
double seaLevelPressure = 760.0;
int sec = 1;
// Переменные для хранения данных
float aX, aY, aZ, aSqrt, gX, gY, gZ, mX, mY, mZ, mDirection;
double temp, pres, density, altitude;
float latitude, longitude;

// Параметры Wi-Fi
const char* ssid = "S24 Ultra";
const char* password = "fartuk123123";

// Настройки UDP
WiFiUDP udp;
const char* udpAddress = "192.168.41.76";  // IP-адрес сервера (замените на актуальный IP адрес)
const unsigned int udpPort = 1234;  // Порт сервера

const int potPin=34;
float ph;
float Value=0;

void setup() {

  Serial.begin(115200);

  pinMode(potPin, INPUT);
  delay(1000);
  
  // Инициализация BMP280
  if (!bmp280.begin(BMP280_ADDRESS)) {
    Serial.println("Could not find a valid BMP280 sensor, check wiring!");
    while (1);
  }

  // Подключение к Wi-Fi сети
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  
  Serial.println("Connected to WiFi");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  // Чтение данных BMP280
  temp = bmp280.readTemperature();
  pres = bmp280.readPressure();

  // Расчет высоты и плотности
  density = (29.0 * pres) / ((temp + 273.15) * 287.058);
  altitude = 44330.0 * (1.0 - pow(pres / 101325.0, 0.1903));

  Value = analogRead(potPin);
  float voltage = Value * (3.3 / 4095.0);
  ph = (3.3 * voltage);
  String dataString = String(Value) + ";" + String(density) + ";" + String(altitude);
  Serial.println(dataString);
  
  // Отправка UDP пакета
  udp.beginPacket(udpAddress, udpPort);
  udp.print(dataString);
  udp.endPacket();
  
  delay(2000);  // Задержка перед отправкой следующего сообщения
}

Error:
`Arduino: 1.8.19 (Windows 10), Board: "ESP32 Dev Module, Disabled, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled, Disabled"

sender:3:10: fatal error: Adafruit_BMP280.h: No such file or directory

compilation terminated.

exit status 1

Adafruit_BMP280.h: No such file or directory

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

But it still gives the following error, does anyone know how to solve it?

Is 'C:\Users\kerey\OneDrive\Documents\Arduino' the sketchbook directory as specified under file/preferences?


Yes it is
P.S "Документы" means Documents

The problem is possibly the characters used in the name of the folder

I think that the non-ascii characters in your path are causing the problem.

I would move the Arduino directory in the path one level up or move it to your documents directory on the C drive.

The name of the folder is "Documents"; and "Документы" is just a link to it - so they are the same for the OS, but not for Arduino. I recommend you to set your "Sketchbook location" in Preferences using the "Documents" folder name rather than "Документы".

Also, the problem might be caused by OneDrive - it is a known issue

At least in this case, is actually not specific to OneDrive. The fault occurs whenever a library is installed under a path that contains post-ASCII characters, regardless of whether that path is on OneDrive, or just a random normal location on the hard drive.

However, there is a correlation with OneDrive because when you have OneDrive enabled, the user "Documents" folder is automatically named with the localized form of the word "documents". This means that users will experience the bug under the following conditions:

  • Windows operating system
  • OneDrive enabled
  • Default sketchbook location
  • Localized (per user's system locale) form of "documents" contains post-ASCII character

However, it could also occur even without OneDrive being enabled, for example if their username contained problematic characters.


The Arduino developers are tracking the bug here:

If you have a GitHub account, you can subscribe to that thread to get notifications of any new developments related to this subject:

screenshot of Subscribe button


:exclamation: Please only comment on the GitHub issue thread if you have new technical information that will assist with the resolution. General discussion and support requests are always welcome here on the Arduino Forum.


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