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?

