Modifications

Sauter à la navigation Sauter à la recherche
2 349 octets ajoutés ,  2 janvier 2017 à 21:02
Ligne 33 : Ligne 33 :     
== Télécharger la bibliothèque ==
 
== Télécharger la bibliothèque ==
 +
To begin reading sensor data, you will need to [https://github.com/adafruit/Adafruit_BME280_Library download Adafruit_BME280 from our github repository]. You can do that by visiting the github repo and manually downloading or, easier, just click this button to download the zip
    +
{{download-box|Téléchargez la bibliothèque BME280|https://github.com/adafruit/Adafruit_BME280_Library}}
 +
 +
Rename the uncompressed folder '''Adafruit_BME280''' and check that the '''Adafruit_BME280''' folder contains '''Adafruit_BME280.cpp''' and '''Adafruit_BME280.h'''
 +
 +
Place the '''Adafruit_BME280''' library folder your '''arduinosketchfolder/libraries/''' folder.
 +
You may need to create the libraries subfolder if its your first library. Restart the IDE.
 +
 +
We also have a [[Installation_d%27un_librairie_Arduino| tutorial on Arduino library installation]]
 +
 +
== Charger la démo ==
 +
Open up '''File->Examples->Adafruit_BME280->bmp280test''' and upload to your Arduino wired up to the sensor
 +
 +
{{ADFImage|BME280-Brancher-30.jpg}}
 +
 +
Depending on whether you are using I2C or SPI, change the pin names and comment or uncomment the following lines.
 +
 +
<syntaxhighlight lang="C">
 +
#define BME_SCK 13
 +
#define BME_MISO 12
 +
#define BME_MOSI 11
 +
#define BME_CS 10
 +
 +
Adafruit_BME280 bme; // I2C
 +
//Adafruit_BME280 bme(BME_CS); // hardware SPI
 +
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO,  BME_SCK);
 +
</syntaxhighlight>
 +
 +
Once uploaded to your Arduino, open up the serial console at 9600 baud speed to see data being printed out
 +
 +
{{ADFImage|BME280-Brancher-31.jpg}}
 +
 +
'''Temperature''' is calculated in degrees C, you can convert this to F by using the classic F = C * 9/5 + 32 equation.
 +
 +
'''Pressure''' is returned in the SI units of '''Pascals'''. 100 Pascals = 1 hPa = 1 millibar. Often times barometric pressure is reported in millibar or inches-mercury. For future reference 1 pascal =0.000295333727 inches of mercury, or 1 inch Hg = 3386.39 Pascal. So if you take the pascal value of say 100734 and divide by 3389.39 you'll get 29.72 inches-Hg.
 +
 +
You can also calculate Altitude. '''However, you can only really do a good accurate job of calculating altitude if you know the hPa pressure at sea level for your location and day!''' The sensor is quite precise but if you do not have the data updated for the current day then it can be difficult to get more accurate than 10 meters.
    
{{BME280-TRAILER}}
 
{{BME280-TRAILER}}
29 917

modifications

Menu de navigation