Modifications

Sauter à la navigation Sauter à la recherche
aucun résumé de modification
Ligne 25 : Ligne 25 :  
{{ADFImage|RASP-FT232H-MPSSE-Usage-GPIO.jpg}}
 
{{ADFImage|RASP-FT232H-MPSSE-Usage-GPIO.jpg}}
   −
With this configuration pin '''C0''' will be a digital output that controls if the LED is on or off, depending on the level of the '''C0''' output. Pin '''D7''' will be a digital input that reads if it's at a high level (3-5 volts) or low level (ground).
+
Dans la configuration ci-dessus, la broche '''C0''' sera une broche de sortie qui allumera/eteindra la LED (en fonction du niveau logique de la sortie '''C0'''. La broche '''D7''' sera une entrée digitale utilisée pour savoir si nous sommes au niveau haut (HIGH, une tension entre 3 et 5V) ou au niveau bas (la masse/GND).
   −
Now create a file named '''gpio_test.py''' in a text editor and fill it with the following Python code:
+
Nous allons maintenant créer un fichier nommé '''gpio_test.py''' avec un éditeur de texte et nous allons remplir ce fichier avec le code suivant:
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# Import standard Python time library.
+
# import de la bibliothèque standard python time.
 
import time
 
import time
   −
# Import GPIO and FT232H modules.
+
# Import des modules GPIO et FT232H.
 
import Adafruit_GPIO as GPIO
 
import Adafruit_GPIO as GPIO
 
import Adafruit_GPIO.FT232H as FT232H
 
import Adafruit_GPIO.FT232H as FT232H
   −
# Temporarily disable the built-in FTDI serial driver on Mac & Linux platforms.
+
# Désactivation temporaire du pilote FTDI série sur les plateformes Mac et Linux.
 
FT232H.use_FT232H()
 
FT232H.use_FT232H()
   −
# Create an FT232H object that grabs the first available FT232H device found.
+
# Créer un objet FT232H (qui capture le premier périphérique FT232H disponible).
 
ft232h = FT232H.FT232H()
 
ft232h = FT232H.FT232H()
   −
# Configure digital inputs and outputs using the setup function.
+
# Configurer les entrée et sortie digitales en utilisant ma méthode setup()
# Note that pin numbers 0 to 15 map to pins D0 to D7 then C0 to C7 on the board.
+
# Note: les broches de 0 a 15 correspondent au broches D0 à D7 puis C0 à C7 de la carte.
 
ft232h.setup(7, GPIO.IN)  # Make pin D7 a digital input.
 
ft232h.setup(7, GPIO.IN)  # Make pin D7 a digital input.
 
ft232h.setup(8, GPIO.OUT)  # Make pin C0 a digital output.
 
ft232h.setup(8, GPIO.OUT)  # Make pin C0 a digital output.
   −
# Loop turning the LED on and off and reading the input state.
+
# Bouche infinie qui change l'état de la LED (allumé/éteind) et lit l'état de l'entrée.
 
print 'Press Ctrl-C to quit.'
 
print 'Press Ctrl-C to quit.'
 
while True:
 
while True:
29 918

modifications

Menu de navigation