english readme

This commit is contained in:
AlexGyver
2023-12-22 23:39:47 +03:00
parent 57f7874a46
commit 60f85caf3f

View File

@@ -1,130 +1,146 @@
This is an automatic translation, may be incorrect in some places. See sources and examples! This is an automatic translation, may be incorrect in some places. See sources and examples!
# GyverBME280 # Gyverbme280
Lightweight BME280 I2C library for Arduino Light library for working with BME280 on I2C for Arduino
### Compatibility ## compatibility
Compatible with all Arduino platforms (using Arduino functions) Compatible with all arduino platforms (used arduino functions)
## Content ## Content
- [Install](#install) - [installation] (# Install)
- [Initialization](#init) - [initialization] (#init)
- [Usage](#usage) - [use] (#usage)
- [Example](#example) - [Example] (# Example)
- [Versions](#versions) - [versions] (#varsions)
- [Bugs and feedback](#feedback) - [bugs and feedback] (#fedback)
<a id="install"> </a> <a id="install"> </a>
## Installation ## Installation
- The library can be found by the name **GyverBME280** and installed via the library manager in: - The library can be found by the name ** gyverbme280 ** and installed through the library manager in:
- Arduino IDE - Arduino ide
- Arduino IDE v2 - Arduino ide v2
- PlatformIO - Platformio
- [Download library](https://github.com/GyverLibs/GyverBME280/archive/refs/heads/main.zip) .zip archive for manual installation: - [download library] (https://github.com/gyverlibs/gyverbme280/archive/refs/heads/main.zip). Zip archive for manual installation:
- Unzip and put in *C:\Program Files (x86)\Arduino\libraries* (Windows x64) - unpack and put in * C: \ Program Files (X86) \ Arduino \ Libraries * (Windows X64)
- Unzip and put in *C:\Program Files\Arduino\libraries* (Windows x32) - unpack and put in * C: \ Program Files \ Arduino \ Libraries * (Windows X32)
- Unpack and put in *Documents/Arduino/libraries/* - unpack and put in *documents/arduino/libraries/ *
- (Arduino IDE) automatic installation from .zip: *Sketch/Include library/Add .ZIP library* and specify the downloaded archive - (Arduino id) Automatic installation from. Zip: * sketch/connect the library/add .Zip library ... * and specify downloaded archive
- Read more detailed instructions for installing libraries [here] (https://alexgyver.ru/arduino-first/#%D0%A3%D1%81%D1%82%D0%B0%D0%BD%D0%BE% D0%B2%D0%BA%D0%B0_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA) - Read more detailed instructions for installing libraries [here] (https://alexgyver.ru/arduino-first/#%D0%A3%D1%81%D1%82%D0%B0%BD%D0%BE%BE%BE%BED0%B2%D0%BA%D0%B0_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA)
### Update
- I recommend always updating the library: errors and bugs are corrected in the new versions, as well as optimization and new features are added
- through the IDE library manager: find the library how to install and click "update"
- Manually: ** remove the folder with the old version **, and then put a new one in its place.“Replacement” cannot be done: sometimes in new versions, files that remain when replacing are deleted and can lead to errors!
<a id="init"> </a> <a id="init"> </a>
## Initialization ## initialization
```cpp `` `CPP
GyverBME280 bme; Gyverbme280 BME;
`` ` `` `
<a id="usage"> </a> <a id="usage"> </a>
## Usage ## Usage
```cpp `` `CPP
boolbegin(void); // run with standard addresscatfish (0x76) Bool Begin (VOID);// Launch with a standard address (0x76)
bool begin(uint8_t address); // run with address Bool Begin (Uint8_T Address);// Launch addressing the address
bool isMeasuring(void); // returns true while the measurement is in progress Bool ISMEASURING (VOID);// returns True while the measurement is underway
float readPressure(void); // read pressure in Pa Float Readpressure (Void);// Read the pressure in PA
float readHumidity(void); // Read humidity in % Float Readhumidity (VOID);// read humidity in %
void oneMeasurement(void); // Take one measurement and go to sleep VOID OneMeasurement (VOID);// make one dimension and go into a dream
float readTemperature(void); // Read temperature in degrees C Float ReadTemperature (VOID);// Read the temperature in degrees with
void setMode(uint8_tmode); // set the mode of operation VOID setmode (uint8_t mode);// set the operating mode
// modes: // modes:
NORMAL_MODE Normal_Mode
FORCED_MODE Forced_Mode
void setFilter(uint8_tmode); // change the filter factor. Call before begin VOID SetFilter (Uint8_t Mode);// Change the filtration coefficient.Call before Begin
// coefficients: // coefficients:
FILTER_DISABLE Filter_disable
FILTER_COEF_2 Filter_coEF_2
FILTER_COEF_4 Filter_coEF_4
FILTER_COEF_8 Filter_coEF_8
FILTER_COEF_16 Filter_coEF_16
void setStandbyTime(uint8_tmode); // Change time between measurements. Call before begin VOID SetstandbyTime (Uint8_t Mode);// Change the time between measurements.Call before Begin
// modes: // modes:
STANDBY_500US Standby_500us
STANDBY_10MS Standby_10ms
STANDBY_20MS Standby_20ms
STANDBY_6250US Standby_6250us
STANDBY_125MS Standby_125MS
STANDBY_250MS Standby_250MS
STANDBY_500MS Standby_500ms
STANDBY_1000MS Standby_1000ms
void setHumOversampling(uint8_t mode); // Set up oversampling or disable humidity. Call before begin VOID sethumoversampling (Uint8_t Mode);// Configure oversemling or turn off humidity.Call before Begin
void setTempOversampling(uint8_t mode); // Set up oversampling or disable temperature. Call before begin VOID settempoVersampling (Uint8_t Mode);// Configure oversemling or turn off the temperature.Call before Begin
void setPressOversampling(uint8_t mode); // Set up oversampling or disable pressure. Call before begin VOID SetPressoversampling (Uint8_t Mode);// configure oversemling or disconnect dCranberry.Call before Begin
// modes: // modes:
MODULE_DISABLE Module_disable
OVERSAMPLING_1 Oversampling_1
OVERSAMPLING_2 Oversampling_2
OVERSAMPLING_4 Oversampling_4
OVERSAMPLING_8 Oversampling_8
OVERSAMPLING_16 Oversampling_16
`` ` `` `
<a id="example"></a> <a id="EXAMPLE"> </a>
## Example ## Example
See **examples** for other examples! The rest of the examples look at ** Examples **!
```cpp `` `CPP
/* /*
A simple example showing the basic functions of measuring temperature, pressure and humidity A simple example, demonstrating the basic functions of measuring temperature, pressure and humidity
*/ */
#include <GyverBME280.h> // Including the library #incLude <gyverbme280.h> // Library connection
GyverBME280 bme; // Create bme object Gyverbme280 BME;// Creating a BME Object
void setup() { VOID setup () {
Serial.begin(9600); // Start serial port Serial.Begin (9600);// launch of the sequential port
bme.begin(); // If add. settings are not needed - initialize the sensor bme.begin ();// if additional.Settings are not needed - initialize the sensor
} }
void loop() {Serial.print("Temperature: "); VOID loop () {
Serial.print(bme.readTemperature()); // Print temperature in [*C] Serial.print ("Temperature:");
Serial.println("*C"); Serial.print (BME.Readtemperature ());// We display the temporary core in [*c]
Serial.println (" *c");
Serial.print ("Humidity:"); Serial.print ("Humidity:");
Serial.print(bme.readHumidity()); // Output humidity in [%] Serial.print (bme.readhumidity ());// We display humidity in [%]
Serial.println (" %"); Serial.println (" %");
float pressure = bme.readPressure(); // Read pressure in [Pa] Float Pressure = Bme.Readpressure ();// read pressure in [pa]
Serial.print ("Pressure:"); Serial.print ("Pressure:");
Serial.print(pressure / 100.0F); // Display pressure in [hPa] Serial.print (Pressure / 100.0F);// Removing pressure in [GPA]
Serial.print(" hPa , "); Serial.print ("hpa,");
Serial.print(pressureToMmHg(pressure)); // Output pressure in [mmHg. pillar] Serial.print (Pressuretommhg (Pressure));// Removing the pressure in [mm RT.pillar]
Serial.println("mm hg"); Serial.println ("MM HG");
Serial.print("Altide: "); Serial.print ("altitide:");
Serial.print(pressureToAltitude(pressure)); // Print height in [m a.s.l. seas] Serial.print// We display height B [m above the ur.seas]
Serial.println ("m"); Serial.println ("m");
Serial.println (""); Serial.println ("");
delay(1000); DELAY (1000);
} }
`` ` `` `
<a id="versions"> </a> <a id="versions"> </a>
## Versions ## versions
- v1.3 - fixed bug when negative. temperature - V1.3 - Fixed error when ledge.temperature
- v1.4 - split into h and cpp - v1.4 - divided into h and CPP
- v1.5 - added support for BMP280 - V1.5 - Added BMP280 support
<a id="feedback"> </a> <a id="feedback"> </a>
## Bugs and feedback ## bugs and feedback
When you find bugs, create an **Issue**, or better, immediately write to the mail [alex@alexgyver.ru](mailto:alex@alexgyver.ru) Create ** Issue ** when you find the bugs, and better immediately write to the mail [alex@alexgyver.ru] (mailto: alex@alexgyver.ru)
The library is open for revision and your **Pull Request**'s! The library is open for refinement and your ** pull Request ** 'ow!
When reporting about bugs or incorrect work of the library, it is necessary to indicate:
- The version of the library
- What is MK used
- SDK version (for ESP)
- version of Arduino ide
- whether the built -in examples work correctly, in which the functions and designs are used, leading to a bug in your code
- what code has been loaded, what work was expected from it and how it works in reality
- Ideally, attach the minimum code in which the bug is observed.Not a canvas of a thousand lines, but a minimum code