kopia lustrzana https://github.com/peterhinch/mpy_bme280_esp8266
update README
rodzic
00b388afbd
commit
a621fefcda
12
README.md
12
README.md
|
@ -1,6 +1,6 @@
|
|||
# README #
|
||||
|
||||
This is a driver for the Bosch BME280 temperature/pressure/humidity sensor, for use with MicroPython-based boards.
|
||||
This is a driver for the Bosch BME280 temperature/pressure/humidity sensor, for use with MicroPython on ESP8266 boards. It is also compatible with the BMP280 which provides the same interface but temperature + pressure only.
|
||||
|
||||
### About the BME280 ###
|
||||
|
||||
|
@ -10,22 +10,22 @@ See the datasheet at https://www.adafruit.com/datasheets/BST-BME280_DS001-10.pdf
|
|||
|
||||
### Using the library ###
|
||||
|
||||
Use ftp to copy `bme280.py` to the `flash` or `flash/lib` directory on the board. Then:
|
||||
Copy `bme280.py`, `bme280_const.py`, `i2c_device.py` onto the board (e.g. using webrepl_cli.py). Then:
|
||||
|
||||
``` python
|
||||
import machine
|
||||
import bme280
|
||||
|
||||
i2c = machine.I2C(0, pins=('GP11', 'GP10'))
|
||||
i2c = machine.I2C(scl=Pin(5), sda=Pin(4))
|
||||
bme = bme280.BME280(i2c=i2c)
|
||||
|
||||
print(bme.temperature, bme.pressure, bme.humidity)
|
||||
print(bme.values)
|
||||
```
|
||||
|
||||
#### Detailed usage ####
|
||||
|
||||
The `temperature`, `pressure` and `humidity` properties are convenience functions that provide human-readable string values to quickly check that the sensor is working. In practice, the methods to use are:
|
||||
The `values` property is a convenience function that provides a tuple of human-readable string values to quickly check that the sensor is working. In practice, the methods to use are:
|
||||
|
||||
* `get_temperature()`: returns the temperature in hundredths of a degree celsius. For example, the value 2534 indicates a temperature of 25.34 degrees.
|
||||
* `get_pressure()`: returns the atmospheric pressure. This 32-bit value consists of 24 bits indicating the integer value, and 8 bits indicating the fractional value. To get a value in Pascals, divide the return value by 256. For example, a value of 24674867 indicates 96386.2Pa, or 963.862hPa.
|
||||
* `get_humidity()`: returns the relative humidity. This 32-bit value consists of 22 bits indicating the integer value, and 10 bits indicating the fractional value. To get a value in %RH, divide the return value by 1024. For example, a value of 47445 indicates 46.333%RH.
|
||||
* `get_humidity()`: returns the relative humidity. This 32-bit value consists of 22 bits indicating the integer value, and 10 bits indicating the fractional value. To get a value in %RH, divide the return value by 1024. For example, a value of 47445 indicates 46.333%RH.
|
||||
|
|
Ładowanie…
Reference in New Issue