esp32_bme280_w_arduino_ide
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
esp32_bme280_w_arduino_ide [2025/04/05 11:55] – bruno | esp32_bme280_w_arduino_ide [2025/08/29 14:07] (current) – removed bruno | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== ESP32 + BME280 w/ Arduino IDE ===== | ||
- | |||
- | [[https:// | ||
- | |||
- | |||
- | **BMP280 vs BME280** -> https:// | ||
- | |||
- | **5V vs 3.3V** -> https:// | ||
- | |||
- | **J'ai un BME280 5V :** | ||
- | |||
- | Connexion BME -> ESP | ||
- | |||
- | ^ BME280 ^ ESP32-DevKitC V4 | | ||
- | | VCC | 5V | | ||
- | | GND | GND | | ||
- | | SDA | GPIO21 (WIRE-SDA)| | ||
- | | SCL | GPIO22 (WIRE-SCL)| | ||
- | |||
- | [[https:// | ||
- | |||
- | <img src=" | ||
- | |||
- | |||
- | * Sketch > Include Library > Manage Libraries > adafuit bme280 | ||
- | * (Sketch > Include Library > Manage Libraries > adafuit unified sensor) | ||
- | * File > Examples > Adafruit BME280 library > bme280test | ||
- | * Comment lines (ligne 20) ''# | ||
- | * Ajouter 0x76 (ligne 46) -> '' | ||
- | |||
- | |||
- | === Code === | ||
- | |||
- | <code c> | ||
- | |||
- | #include < | ||
- | #include < | ||
- | #include < | ||
- | |||
- | Adafruit_BME280 bme; // I2C | ||
- | |||
- | void setup() { | ||
- | Serial.begin(115200); | ||
- | while(!Serial); | ||
- | |||
- | unsigned status; | ||
- | | ||
- | status = bme.begin(0x76); | ||
- | if (!status) { | ||
- | Serial.println(" | ||
- | Serial.print(" | ||
- | Serial.print(" | ||
- | Serial.print(" | ||
- | Serial.print(" | ||
- | Serial.print(" | ||
- | while (1) delay(10); | ||
- | } | ||
- | Serial.println(); | ||
- | } | ||
- | |||
- | |||
- | void loop() { | ||
- | printValues(); | ||
- | delay(1000); | ||
- | } | ||
- | |||
- | |||
- | void printValues() { | ||
- | Serial.print(" | ||
- | Serial.print(bme.readTemperature()); | ||
- | Serial.println(" | ||
- | |||
- | Serial.print(" | ||
- | Serial.print(bme.readPressure() / 100.0F); | ||
- | Serial.println(" | ||
- | |||
- | Serial.print(" | ||
- | Serial.print(bme.readHumidity()); | ||
- | Serial.println(" | ||
- | |||
- | Serial.println(); | ||
- | } | ||
- | |||
- | </ |
esp32_bme280_w_arduino_ide.1743854142.txt.gz · Last modified: 2025/04/05 11:55 by bruno