Ligne 87 : |
Ligne 87 : |
| | | |
| == Référence de la bibliothèque == | | == Référence de la bibliothèque == |
− | You can start out by creating a BME280 object with either software SPI (where all four pins can be any I/O) using
| + | Vous pouvez commencer par créer un objet BME280, avec par exemple l'utilisation d'un bus SPI logiciel (où il est raccordé à 4 broches I/O) en utilisant |
| | | |
| <syntaxhighlight lang="C"> | | <syntaxhighlight lang="C"> |
Ligne 93 : |
Ligne 93 : |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | Or you can use hardware SPI. With hardware SPI you ''must'' use the hardware SPI pins for your Arduino - and each arduino type has different pins! Check the SPI reference to see what pins to use.
| + | Ou vous pouvez utiliser le bus SPI matériel. Avec le bus SPI matériel vous ''devez'' utiliser le bus matériel de votre Arduino - et chaque type d'Arduino utilise des broches différentes pour son but SPI matériel! Voyez les informations de référence de votre modèle d'Arduino pour connaître les broches ddu bus SPI. |
− | In this case, you can use any CS pin, but the other three pins are fixed
| + | |
| + | Dans ce cas, vous pouvez utiliser la broche CS de votre chaois (mais les trois autres broches sont fixées). |
| | | |
| <syntaxhighlight lang="C"> | | <syntaxhighlight lang="C"> |
− | Adafruit_BME280 bme(BME_CS); // hardware SPI | + | Adafruit_BME280 bme(BME_CS); // SPI materiel |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | or I2C using the default I2C bus, no pins are assigned
| + | Ou le bus I2C materiel, aucune broche est assignée. |
| | | |
| <syntaxhighlight lang="C"> | | <syntaxhighlight lang="C"> |
Ligne 106 : |
Ligne 107 : |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | Once started, you can initialize the sensor with
| + | Une fois démarré, vous pouvez initialiser le senseur avec |
| | | |
| <syntaxhighlight lang="C"> | | <syntaxhighlight lang="C"> |
| if (!bme.begin()) { | | if (!bme.begin()) { |
− | Serial.println("Could not find a valid BME280 sensor, check wiring!"); | + | Serial.println("Impossible de trouver un senseur BME280, verifier vos raccordements!"); |
| while (1); | | while (1); |
| } | | } |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | '''begin()''' will return True if the sensor was found, and False if not. If you get a False value back, check your wiring! | + | '''begin()''' retourne True si le senseur à été trouvé et False si ce n'est pas le cas. Si vous obtenez la valeur False, il faut alors vérifier vos raccordements! |
| | | |
− | Reading humidity, temperature and pressure is easy, just call:
| + | La lecture de la température, de l'humidité et la pression est facile. Appelez simplement les fonctions suivantes: |
| | | |
| <syntaxhighlight lang="C"> | | <syntaxhighlight lang="C"> |
− | bme.readTemperature() | + | bme.readTemperature() # lecture de la temperature |
− | bme.readPressure() | + | bme.readPressure() # lecture de la pression |
− | bme.readHumidity() | + | bme.readHumidity() # lecture de l humidite |
| </syntaxhighlight> | | </syntaxhighlight> |
| + | |
| + | {{traduction}} |
| | | |
| Temperature is always a floating point, in Centigrade. Pressure is a 32 bit integer with the pressure in Pascals. You may need to convert to a different value to match it with your weather report. Humidity is in % Relative Humidity | | Temperature is always a floating point, in Centigrade. Pressure is a 32 bit integer with the pressure in Pascals. You may need to convert to a different value to match it with your weather report. Humidity is in % Relative Humidity |