esp32_bme280_w_arduino_ide
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
esp32_bme280_w_arduino_ide [2025/03/06 21:05] – bruno | esp32_bme280_w_arduino_ide [2025/03/10 15:27] (current) – bruno | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== ESP32 + BME280 w/ Arduino IDE ===== | ===== ESP32 + BME280 w/ Arduino IDE ===== | ||
- | Sketch > Include Library > Manage Libraries > adafuit bme280 | ||
- | (Sketch > Include Library > Manage Libraries > adafuit unified sensor) | + | [[https:// |
**BMP280 vs BME280** -> https:// | **BMP280 vs BME280** -> https:// | ||
Line 9: | Line 9: | ||
**5V vs 3.3V** -> https:// | **5V vs 3.3V** -> https:// | ||
- | ** BME280 5V :** | + | **J'ai un BME280 5V :** |
Connexion BME -> ESP | Connexion BME -> ESP | ||
Line 19: | Line 19: | ||
| SCL | GPIO22| | | SCL | GPIO22| | ||
- | + | * Sketch > Include Library > Manage Libraries > adafuit bme280 | |
- | File > Examples > Adafruit BME280 library > bme280test | + | * (Sketch > Include Library > Manage Libraries > adafuit unified sensor) |
- | + | * File > Examples > Adafruit BME280 library > bme280test | |
- | Comment lines | + | |
- | <code c> | + | * Ajouter |
- | //#include < | + | |
- | </ | + | |
- | et | + | |
- | <code c> | + | |
- | /*#define BME_SCK 13 | + | |
- | #define BME_MISO 12 | + | |
- | #define BME_MOSI 11 | + | |
- | #define BME_CS 10*/ | + | |
- | </ | + | |
- | et ajoute | + | |
- | <code c> | + | |
- | status = bme.begin(0x76); | + | |
- | </ | + | |
- | + | ||
- | /!\ Serial monitor @ 9600 baud | + | |
Line 44: | Line 29: | ||
<code c> | <code c> | ||
+ | |||
#include < | #include < | ||
- | //#include < | ||
#include < | #include < | ||
#include < | #include < | ||
- | |||
- | /*#define BME_SCK 13 | ||
- | #define BME_MISO 12 | ||
- | #define BME_MOSI 11 | ||
- | #define BME_CS 10*/ | ||
- | |||
- | #define SEALEVELPRESSURE_HPA (1013.25) | ||
Adafruit_BME280 bme; // I2C | Adafruit_BME280 bme; // I2C | ||
- | // | ||
- | // | ||
- | |||
- | unsigned long delayTime; | ||
void setup() { | void setup() { | ||
- | Serial.begin(9600); | + | Serial.begin(115200); |
while(!Serial); | while(!Serial); | ||
- | Serial.println(F(" | ||
unsigned status; | unsigned status; | ||
| | ||
- | // default settings | ||
status = bme.begin(0x76); | status = bme.begin(0x76); | ||
- | // You can also pass in a Wire library object like &Wire2 | ||
- | // status = bme.begin(0x76, | ||
if (!status) { | if (!status) { | ||
Serial.println(" | Serial.println(" | ||
Line 82: | Line 52: | ||
while (1) delay(10); | while (1) delay(10); | ||
} | } | ||
- | | ||
- | Serial.println(" | ||
- | delayTime = 1000; | ||
- | |||
Serial.println(); | Serial.println(); | ||
} | } | ||
Line 92: | Line 58: | ||
void loop() { | void loop() { | ||
printValues(); | printValues(); | ||
- | delay(delayTime); | + | delay(1000); |
} | } | ||
Line 102: | Line 68: | ||
Serial.print(" | Serial.print(" | ||
- | |||
Serial.print(bme.readPressure() / 100.0F); | Serial.print(bme.readPressure() / 100.0F); | ||
Serial.println(" | Serial.println(" | ||
- | |||
- | Serial.print(" | ||
- | Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); | ||
- | Serial.println(" | ||
Serial.print(" | Serial.print(" | ||
Line 116: | Line 77: | ||
Serial.println(); | Serial.println(); | ||
} | } | ||
+ | |||
</ | </ |
esp32_bme280_w_arduino_ide.1741295150.txt.gz · Last modified: 2025/03/06 21:05 by bruno