meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
sensor:bmp_bme [2026/03/21 19:59] – [I²C topics on lamaPLC] vamsansensor:bmp_bme [2026/03/31 18:26] (current) – [GY-BMP280-3.3 Pinout] vamsan
Line 94: Line 94:
  
 {{page>:tarhal}} {{page>:tarhal}}
 +
 +==== GY-BMP280/HW-611 Arduino code ====
 +<code c>
 +// include
 +#include <Wire.h>
 +#include <Adafruit_Sensor.h>
 +#include <Adafruit_BMP280.h> // BMP280/HW-611
 +
 +// variable
 +float bmp_280_temp;
 +float bmp_280_press;
 +bool bmp_280_ready;
 +String unitID = "abcd";
 +
 +// init
 +Adafruit_BMP280 bmp_280; // BMP280/HW-611
 +
 +// call block
 +void bmp_280_function () {
 +  bmp_280_temp = bmp_280.readTemperature();
 +  bmp_280_press = bmp_280.readPressure() / 100.0F;
 +  Serial.print("unitID: "); Serial.print(unitID); Serial.print("; bmp_280_temp: "); Serial.print(bmp_280_temp); Serial.println(" ; unit: C");
 +  Serial.print("unitID: "); Serial.print(unitID); Serial.print("; bmp_280_press: "); Serial.print(bmp_280_press); Serial.println(" ; unit: hPa");
 +}
 +
 +
 +void setup() {
 +  Serial.begin(115200);
 +    // unit works?
 +    bmp_280_ready = bmp_280.begin(0x76); 
 +    if (!bmp_280_ready) {
 +    Serial.println("BMP280/HW-611 Sensor not found");
 +    } else {
 + Serial.println("BMP280/HW-611 Sensor works");
 + }
 +  }
 +
 +void loop() {
 +  // call all units with 2 sec raster
 +  static unsigned long lastTime = 0;
 +  if (millis() - lastTime > 2000) {
 +    lastTime = millis();
 +    // units call, if works
 +    if (bmp_280_ready) {bmp_280_function ();}
 +  }
 +}
 +</code>
 ==== CJMCU-680 Temperature/Humidity/Barometric Pressure/Gas (VOC) Module ==== ==== CJMCU-680 Temperature/Humidity/Barometric Pressure/Gas (VOC) Module ====
 {{ :sensor:cjmcu_680_1.png?150|CJMCU-680}} {{ :sensor:cjmcu_680_1.png?150|CJMCU-680}}