Ligne 91 : |
Ligne 91 : |
| | | |
| <syntaxhighlight lang="python"> | | <syntaxhighlight lang="python"> |
| + | # Read the sensor values: |
| + | # (temperature_celcius, pressure_hpa, humidity_percent) |
| + | # Humidity only applies to BME280 only, not BMP280. |
| + | # |
| from machine import I2C | | from machine import I2C |
| # BME280 aslo work for BMP280 | | # BME280 aslo work for BMP280 |
Ligne 104 : |
Ligne 108 : |
| | | |
| Which produce the following results: | | Which produce the following results: |
− | | + | <nowiki>(22.28, 1017.68, 0.0) |
− | <syntaxhighlight lang="bash"> | |
− | (22.28, 1017.68, 0.0) | |
| (22.27, 1017.66, 0.0) | | (22.27, 1017.66, 0.0) |
| (21.87, 1017.67, 0.0) | | (21.87, 1017.67, 0.0) |
Ligne 112 : |
Ligne 114 : |
| (21.83, 1017.68, 0.0) | | (21.83, 1017.68, 0.0) |
| (21.81, 1017.68, 0.0) | | (21.81, 1017.68, 0.0) |
− | (21.81, 1017.68, 0.0) | + | (21.81, 1017.68, 0.0)</nowiki> |
− | </syntaxhighlight> | |
| | | |
| By activating the Plotter, the value can even be made visible as a graph. However, to see a proper graph evolution, the best is to replace the {{fname|sleep(1)}} to {{fname|sleep( 60*30 )}} (30 min). | | By activating the Plotter, the value can even be made visible as a graph. However, to see a proper graph evolution, the best is to replace the {{fname|sleep(1)}} to {{fname|sleep( 60*30 )}} (30 min). |
Ligne 149 : |
Ligne 150 : |
| | | |
| <syntaxhighlight lang="python"> | | <syntaxhighlight lang="python"> |
| + | # Read Local pressure then |
| + | # Calculate corresponding Altitude |
| + | # |
| from machine import I2C | | from machine import I2C |
| # BME280 aslo work for BMP280 | | # BME280 aslo work for BMP280 |
Ligne 215 : |
Ligne 219 : |
| from bme280 import BME280, BMP280_I2CADDR | | from bme280 import BME280, BMP280_I2CADDR |
| from time import sleep | | from time import sleep |
− | i2c = I2C(1) | + | i2c = I2C(0) |
| | | |
| # Sensor altitude (in meter) required to | | # Sensor altitude (in meter) required to |