BMx280 - Environmental Sensors
Barometric pressure, temperature, and humidity (BME280 only) sensor using I2C bus.
This sensor is not used in the TWELITE PAL series. Please refer to the following for usage examples. https://github.com/monowireless/ActEx_Sns_BME280_SHT30
1 Wire.begin()
: Initialize bus 2 .setup()
: Initialize the sensor 3..begin()
: Start operation of the sensor 4. 4.wait(): wait for a few ms 5.
.available()becomes
true 6. .get_press(), .get_temp(), .get_humid()
: read values
Before calling the setup()
method, the Wire must be put into operation by Wire.begin()
.
Keep the Wire bus in the operating state just before sleep (the Wire is automatically restored after sleep).
#include <SNS_SHT3X>
and declaration of SNS_SHT3X
class object is required.
Call .begin()
to start acquiring sensor values. It takes several ms to complete.
In the above loop()
, the process is designed to branch according to the state variable eState
. (Reference)
Whether the sensor value is ready or not can be determined by .available()
.
As soon as the sensor value is ready, the value can be read out.
.get_temp(), get_humid()
includes floating point operations; you can also get 100x integer values.
Here div100()
is used to decompose 100x values into integer and decimal parts.
Reads the atmospheric pressure. The unit is the hectopascal (hectopascal), usually around 1000.
Read temperature. get_temp()
returns a value in °C and get_temp_cent()
returns an integer value that is 100 times the value in °C.
On error, values between -32760 and -32768 are returned.
Reads the humidity. get_humid()
returns an integer value in % and get_humid_per_dmil()
returns 100 times %.
On error, values between -32760 and -32768 are returned.
Allocates and initializes the memory area for the sensor.
The 8 bits from LSB of arg1
can store the I2C address. If not specified, leave it as 0.
The above code first tries to see if the device responds with the default I2C ID, and if not, tries with 0x77
.
Starts acquiring a sensor. It takes a few ms to read the value of the sensor and must wait until available()
is true
.
It does not support end()
.
In the case of a sensor with wait processing, arg1
is given E_EVENT_TICK_TIMER
or E_EVENT_START_UP
to indicate the elapse of time. After calling this method, if the required time has elapsed, available()
will be set to true
and the sensor value can be read.
Returns true
when the sensor satisfies the readout condition.
Returns true
when the sensor is connected.
Various information on the sensor device is stored.
The lower 8 bits store the chip model of BME280/BMP280. If it is 0x60
, it is BME280, and if it is 0x58
, it is BMP280.
The value passed in setup(uint32_t arg1)
is stored.
The lower 8 bits contain the address of the specified I2C device.