Modifications

Sauter à la navigation Sauter à la recherche
202 octets ajoutés ,  15 août 2016 à 15:03
Ligne 21 : Ligne 21 :     
== Démarrage ==
 
== Démarrage ==
 +
Au tout début du script nous faisons quelques {{fname|import}} pour le support multitâche (''threading'') et la conversion ADC.
   −
At the top of this script now we have some more imports for the threading and ADC.
+
Le gain et le taux d'échantillonnage sont configurés et le convertisseur ADC est initialisé.
 
  −
The gain and sample rate are configured and the ADC initialized.
      
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 43 : Ligne 42 :  
ADS1115 = 0x01  # 16-bit ADC
 
ADS1115 = 0x01  # 16-bit ADC
 
   
 
   
# Select the gain
+
# Sélectionner le gain
 
# gain = 6144  # +/- 6.144V
 
# gain = 6144  # +/- 6.144V
 
gain = 4096  # +/- 4.096V
 
gain = 4096  # +/- 4.096V
Ligne 51 : Ligne 50 :  
# gain = 256  # +/- 0.256V
 
# gain = 256  # +/- 0.256V
 
   
 
   
# Select the sample rate
+
# Sélectionner le taux d'échantillonnage
sps = 8    # 8 samples per second
+
sps = 8    # 8 échantillons par seconde
# sps = 16  # 16 samples per second
+
# sps = 16  # 16 échantillons par seconde
# sps = 32  # 32 samples per second
+
# sps = 32  # 32 échantillons par seconde
# sps = 64  # 64 samples per second
+
# sps = 64  # 64 échantillons par seconde
# sps = 128  # 128 samples per second
+
# sps = 128  # 128 échantillons par seconde
# sps = 250  # 250 samples per second
+
# sps = 250  # 250 échantillons par seconde
# sps = 475  # 475 samples per second
+
# sps = 475  # 475 échantillons par seconde
# sps = 860  # 860 samples per second
+
# sps = 860  # 860 échantillons par seconde
 
   
 
   
# Initialise the ADC using the default mode (use default I2C address)
+
# Initialiser le convertisseur ADC en utilisant le mode par défaut (et adresse I2C par défaut)
# Set this to ADS1015 or ADS1115 depending on the ADC you are using!
+
# Utilisez ADS1015 ou ADS1115 en fonction de l'ADC que vous utilisez!
 
adc = ADS1x15(ic=ADS1115)
 
adc = ADS1x15(ic=ADS1115)
 
   
 
   
#Setup the GPIOs as outputs - only 4 and 17 are available
+
# Configurer les GPIOs en sortie (OUTPUT) - seuls 4 et 17 sont disponibles
 
GPIO.setmode(GPIO.BCM)
 
GPIO.setmode(GPIO.BCM)
 
GPIO.setup(4, GPIO.OUT)
 
GPIO.setup(4, GPIO.OUT)
29 923

modifications

Menu de navigation