Modifications

Sauter à la navigation Sauter à la recherche
202 octets ajoutés ,  2 janvier 2017 à 11:43
Ligne 75 : Ligne 75 :  
</syntaxhighlight>
 
</syntaxhighlight>
    +
Vous pouvez constater dans les commentaires qu'il existe différentes façons de créer une instance du senseur.
   −
You can see from the comments there are a few ways to create the sensor instance. By default if you pass no parameters the library will try to find the right I2C bus for your device. For a Raspberry Pi the library will detect the revision number and use the appropriate bus (0 or 1). For a Beaglebone Black there are multiple I2C buses so the library defaults to bus 1, which is exposed with pin P9_19 as SCL clock and P9_20 as SDA data. You can explicitly set the bus number by passing it in the busnum parameter.
+
Par défaut, si vous ne passez aucun paramètre alors la bibliothèque essaye d'identifier le bon bus I2C pour le périphérique. Sur un Raspberry-Pi, la bibliothèque utilise le numéro de révision du Pi pour sélectionner le numéro de bus approprié (0 ou 1). Comme le Beaglebone Black dispose de plusieurs bus I2C, la bibliothèque utilise le bus 1 par défaut (exposé sur les broches P9_19 pour SCL et P9_20 pour SDA). Vous pouvez fixer explicitement le numéro de bus en passant un paramètre busnum .
   −
'''Note if you're using a BeagleBone Black with the Ubuntu operating system you might need to change busnum to 2 to use the P9_19 & P9_20 pin I2C connectio'''n.  Just change the line to look like: '''sensor = BMP.BMP085(busnum=2)'''
+
{{underline|'''Si vous utilisez BeagleBone Black avec Ubuntu'''}} alors vous pourriez avoir besoin d'utiliser le busnum 2 pour utiliser les broches I2C P9_19 & P9_20. Modifiez simplement la ligne pour qu'elle ressemble à '''sensor = BMP.BMP085(busnum=2)'''
   −
The library will also choose by default to use the BMP sensor's standard operation mode. You can override this by passing a mode parameter with an explicit mode value--check the [http://www.adafruit.com/datasheets/BMP085_DataSheet_Rev.1.0_01July2008.pdf fiche technique du BMP] for more information on its modes.
+
Par défaut, la bibliothèque utilise le senseur en mode standard. Il est possible de choisir explicitement le mode utilisé en passant un paramète {{fname|mode}} --voyez la [http://www.adafruit.com/datasheets/BMP085_DataSheet_Rev.1.0_01July2008.pdf fiche technique du BMP] pour plus d'information sur les modes disponibles.
   −
Once the BMP sensor instance is created, you can read its values by calling the {{fname|read_temperature}}, {{fname|read_pressure}}, {{fname|read_altitude}}, and {{fname|read_sealevel_pressure}} functions like below:
+
Une fois l'instance du senseur BMP créée, vous pouvez lire les valeur en appelant les fonctions {{fname|read_temperature}}, {{fname|read_pressure}}, {{fname|read_altitude}} et {{fname|read_sealevel_pressure}} (comme présenté ci-dessous):
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 91 : Ligne 92 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
That's all you need to do to read BMP sensor values using the Adafruit Python BMP library!
+
C'est tout ce que vous aurez besoin de faire pour lire les différentes valeurs du senseur avec la bibliothèque python!
    
For another example of using the BMP library, check out the google_spreadsheet.py example. This code is similar to the [https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/overview DHT sensor Google Docs spreadsheet logging code] (''Adafruit, Anglais''), but is modified to use the BMP sensor and write the temperature, pressure, and altitude to a Google Docs spreadsheet. Check out the [https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/connecting-to-googles-docs-updated page on configuring Google Docs] to see more details on how to create the spreadsheet and configure the username, password, and spreadsheet name.  
 
For another example of using the BMP library, check out the google_spreadsheet.py example. This code is similar to the [https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/overview DHT sensor Google Docs spreadsheet logging code] (''Adafruit, Anglais''), but is modified to use the BMP sensor and write the temperature, pressure, and altitude to a Google Docs spreadsheet. Check out the [https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/connecting-to-googles-docs-updated page on configuring Google Docs] to see more details on how to create the spreadsheet and configure the username, password, and spreadsheet name.  
    
{{Rasp-Hack-BMP085-TRAILER}}
 
{{Rasp-Hack-BMP085-TRAILER}}
29 910

modifications

Menu de navigation