meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| sensor:bmp_bme [2026/03/21 19:59] – [I²C topics on lamaPLC] vamsan | sensor:bmp_bme [2026/03/31 18:26] (current) – [GY-BMP280-3.3 Pinout] vamsan | ||
|---|---|---|---|
| Line 94: | Line 94: | ||
| {{page>: | {{page>: | ||
| + | |||
| + | ==== GY-BMP280/ | ||
| + | <code c> | ||
| + | // include | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | // variable | ||
| + | float bmp_280_temp; | ||
| + | float bmp_280_press; | ||
| + | bool bmp_280_ready; | ||
| + | String unitID = " | ||
| + | |||
| + | // init | ||
| + | Adafruit_BMP280 bmp_280; // BMP280/ | ||
| + | |||
| + | // call block | ||
| + | void bmp_280_function () { | ||
| + | bmp_280_temp = bmp_280.readTemperature(); | ||
| + | bmp_280_press = bmp_280.readPressure() / 100.0F; | ||
| + | Serial.print(" | ||
| + | Serial.print(" | ||
| + | } | ||
| + | |||
| + | |||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | // unit works? | ||
| + | bmp_280_ready = bmp_280.begin(0x76); | ||
| + | if (!bmp_280_ready) { | ||
| + | Serial.println(" | ||
| + | } else { | ||
| + | Serial.println(" | ||
| + | } | ||
| + | } | ||
| + | |||
| + | 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 ();} | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| ==== CJMCU-680 Temperature/ | ==== CJMCU-680 Temperature/ | ||
| {{ : | {{ : | ||