Modifications

Sauter à la navigation Sauter à la recherche
2 081 octets ajoutés ,  11 février 2017 à 10:56
aucun résumé de modification
Ligne 1 : Ligne 1 :  
{{Rasp-Hack-Afficheur-LCD-NAV}}
 
{{Rasp-Hack-Afficheur-LCD-NAV}}
  −
{{traduction}}
      
== Pre-requis ==
 
== Pre-requis ==
Ligne 48 : Ligne 46 :     
Plus particulièrement, le module {{fname|Adafruit_CharLCD}} est importé sous le nom LCD. Vous verrez plus tard, dans le script, comment les classes du module LCD sont utilisées pour interagit avec l'afficheur.  
 
Plus particulièrement, le module {{fname|Adafruit_CharLCD}} est importé sous le nom LCD. Vous verrez plus tard, dans le script, comment les classes du module LCD sont utilisées pour interagit avec l'afficheur.  
  −
{{traduction}}
      
La prochaine partie du script défini la correspondance entre les broches GPIO et leur utilisation/branchement sur l'afficheur LCD. Vous pouvez constater que la configuration Pi est active par défaut et que la configuration pour BeagleBone est désactivée (en commentaire).  
 
La prochaine partie du script défini la correspondance entre les broches GPIO et leur utilisation/branchement sur l'afficheur LCD. Vous pouvez constater que la configuration Pi est active par défaut et que la configuration pour BeagleBone est désactivée (en commentaire).  
Ligne 87 : Ligne 83 :  
lcd_rows    = 2
 
lcd_rows    = 2
   −
# Alternatively specify a 20x4 LCD.
+
# Dimension alternative pour LCD 20x4 .
 
# lcd_columns = 20
 
# lcd_columns = 20
 
# lcd_rows    = 4
 
# lcd_rows    = 4
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
Next an instance of the '''Adafruit_CharLCD''' class is created based on the configuration specified earlier in the script.  
+
Ensuite, nous allons créer une instance de de la classe '''Adafruit_CharLCD''' en lui précisant les différents paramètres de configuration (que nous avons précisé plus haut dans le script).  
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# Initialize the LCD using the pins above.
+
# Initialisation du LCD (avec definition du brochage)
 
lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7,  
 
lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7,  
 
                           lcd_columns, lcd_rows, lcd_backlight)
 
                           lcd_columns, lcd_rows, lcd_backlight)
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
The next lines demonstrate basic usage of the LCD display class. The {{fname|message}} function can be used to write a string of text to the display (including support for line breaks). The {{fname|clear}} function clears the display, and the {{fname|show_cursor}} and {{fname|blink}} functions specify if the cursor is shown and should blink.
+
Les lignes suivantes démontrent l'utilisation de la classe d'affichage LCD. La fonction {{fname|message}} peut être utilisé pour afficher une chaîne de caractère sur l'afficheur (supporte le retour à la ligne ''line breaks''). La fonction {{fname|clear}} efface le contenu de l'afficheur, la fonction {{fname|show_cursor}} et {{fname|blink}} affichent le curseur et le fait clignoter.
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# Print a two line message
+
# Affiche un message en deux lignes
 
lcd.message('Hello\nworld!')
 
lcd.message('Hello\nworld!')
   −
# Wait 5 seconds
+
# Attends 5 secondes
 
time.sleep(5.0)
 
time.sleep(5.0)
   −
# Demo showing the cursor.
+
# Affiche le curseur.
 
lcd.clear()
 
lcd.clear()
 
lcd.show_cursor(True)
 
lcd.show_cursor(True)
Ligne 116 : Ligne 112 :  
time.sleep(5.0)
 
time.sleep(5.0)
   −
# Demo showing the blinking cursor.
+
# Affiche un curseur clignotant.
 
lcd.clear()
 
lcd.clear()
 
lcd.blink(True)
 
lcd.blink(True)
Ligne 123 : Ligne 119 :  
time.sleep(5.0)
 
time.sleep(5.0)
   −
# Stop blinking and showing cursor.
+
# Arrête le clignotement du curseur et masque le curseur.
 
lcd.show_cursor(False)
 
lcd.show_cursor(False)
 
lcd.blink(False)
 
lcd.blink(False)
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
 
+
La classe LCD expose d'autres fonctions (des ''méthodes'') que nous n'avons pas abordé ici. Cela ne veut pas dire qu'elle ne seraient pas utiles. N'hésitez pas à afficher l'aide contextuel de la classe LCD en utilisant la fonction d'aide {{fname|help()}} de python. (ignorez l'invite de commande >>> , elle n'est là que comme référence pour signalé que nous utilisons l'interpréteur Python):  
 
  −
Although not shown above, there are other functions you might find useful on the LCD class. To see details on all functions you can have Python print help text for the class by executing (ignore the >>> prompt, it's only shown for reference as the Python interpreter):  
      
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 138 : Ligne 132 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
You should see a description of each function on the LCD class, including some functions not shown in the example:
+
Vous devriez voir la description de chaque fonction de la classe LCD, y compris les fonctions non utilisées dans l'exemple:
    
  autoscroll(autoscroll)
 
  autoscroll(autoscroll)
   −
Autoscroll will 'right justify' text from the cursor if set True, otherwise it will 'left justify' the text.
+
Autoscroll fera 'une justification à droite' à partir du curseur (si le paramètre est à ''True''), sinon le texte est 'justifié à gauche'.
    
  enable_display(enable)
 
  enable_display(enable)
   −
Enable or disable the display. Set enable to True to enable.
+
Active ou désactive l'afficheur. Placez le paramètre à True pour activer l'écran.
    
  home()
 
  home()
   −
Move the cursor back to its home (first line and first column).
+
Déplace le curseur à la poisition "home" (première ligne, première colonne).
    
  set_backlight(backlight)
 
  set_backlight(backlight)
   −
Enable or disable the backlight. If PWM is not enabled (default), a non-zero backlight value will turn on the backlight and a zero value will turn it off. If PWM is enabled, backlight can be any value from 0.0 to 1.0, with 1.0 being full intensity backlight.
+
Active ou désactivé le rétro-élcairage. SI la sortie PWM n'est pas active (comportement par défaut) ALORS une valeur supérieure à 0 activera le réstro-élcairage SINON une valeur égale à zero désactive le rétro-élcairage. Si le signal PWM est activé alors le le rétro-éclairage peut être contrôlé en utilisant une valeur entre 0.0 et 1.0, avec la valeur 1.0 étant l'intensité maximale du rétro-élcairage.
    
  set_cursor(col, row)
 
  set_cursor(col, row)
   −
Move the cursor to an explicit column and row position.
+
Déplace le curseur sur une colonne (''column'') et ligne (''row'') explicite.
   −
Finally, the last portion of the '''char_lcd.py''' script:
+
Pour finir, la dernière portion du script '''char_lcd.py''':
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# Demo scrolling message right/left.
+
# Demo du defillement de message de droite/gauche.
 
lcd.clear()
 
lcd.clear()
 
message = 'Scroll'
 
message = 'Scroll'
Ligne 174 : Ligne 168 :  
lcd.move_left()
 
lcd.move_left()
   −
# Demo turning backlight off and on.
+
# Demo activer et desactiver le retro-eclairage.
 
lcd.clear()
 
lcd.clear()
 +
# Message: flash du retro-eclairage dans 5 secondes
 
lcd.message('Flash backlight\nin 5 seconds...')
 
lcd.message('Flash backlight\nin 5 seconds...')
 
time.sleep(5.0)
 
time.sleep(5.0)
# Turn backlight off.
+
# eteindre le retro-eclairage.
 
lcd.set_backlight(0)
 
lcd.set_backlight(0)
 
time.sleep(2.0)
 
time.sleep(2.0)
# Change message.
+
# Changer le message.
 
lcd.clear()
 
lcd.clear()
 
lcd.message('Goodbye!')
 
lcd.message('Goodbye!')
# Turn backlight on.
+
# activer le retro-eclairage.
 
lcd.set_backlight(1)
 
lcd.set_backlight(1)
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
You can see how the {{fname|move_right}} and {{fname|move_left}} functions are used to scroll the display, and further down how the {{fname|set_backlight}} function turns off and on the backlight.
+
Vous pouvez voir comment les fonctions {{fname|move_right}} et {{fname|move_left}} sont utilisées pour faire défiler l'affichage... et plus bas dans le code, les appels à la fonction {{fname|set_backlight}} pour allumer et éteindre le rétro-éclairage.
   −
That's all there is to using the '''Adafruit_CharLCD''' class!
+
C'est tout ce que vous avez besoin de savoir pour pouvoir utiliser la classe '''Adafruit_CharLCD'''!
    
== Avec un LCD RGB ==
 
== Avec un LCD RGB ==
If you're using an RGB backlight LCD the '''char_lcd_rgb.py''' script will demonstrate the usage.
+
Si vous utiliser un LCD avec rétro-éclairage RGB, alors utilisez le script '''char_lcd_rgb.py''' qui démontre l'utilisation d'un tel écran.
   −
If you're using a Raspberry Pi and have wired it according to this guide, you can immediately run the script. However if you're using a BeagleBone Black or have changed the wiring, edit the script with a text editor and uncomment/change the lines at the top that define the LCD pins.
+
Si vous utilisez un Raspberry pi et si vous raccordé l'écran comme indiqué dans ce guide alors vous pourrez exécuter immédiatement le script.
   −
To execute the RGB backlight example run this command from inside the '''examples''' directory:
+
Pour exécuter l'exemple rétro-éclairage RGB, exécutez la commande suivante depuis le répertoire '''examples''' (contenant les examples):
    
  sudo python char_lcd_rgb.py
 
  sudo python char_lcd_rgb.py
   −
You should see the LCD turn on and display different backlight colors. For example:
+
Vous devriez voir votre écran LCD s'allumer et présenter différentes couleurs. Par exemple:
    
{{ADFImage|Rasp-Hack-Afficheur-LCD-Python-a10.jpg}}
 
{{ADFImage|Rasp-Hack-Afficheur-LCD-Python-a10.jpg}}
   −
If you open the file '''char_lcd_rgb.py''' in a text editor (such as nano) I'll describe the important differences between it and the previous '''char_lcd.py''' example below.
+
Si vous ouvrez le fichier '''char_lcd_rgb.py''' dans un éditeur de texte (tel que nano) vous noterez d'importantes différences avec l'exemple précédent '''char_lcd.py''', différences que nous détaillons ci-dessous.
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# Example Raspberry Pi configuration:
+
# Exemple de configuration pour Raspberry-Pi:
lcd_rs = 27  # Change this to pin 21 on older revision Raspberry Pi's
+
lcd_rs = 27  # Changer cette broches à 21 pour une ancienne révision de Raspberry Pi
 
lcd_en = 22
 
lcd_en = 22
 
lcd_d4 = 25
 
lcd_d4 = 25
Ligne 215 : Ligne 210 :  
lcd_d6 = 23
 
lcd_d6 = 23
 
lcd_d7 = 18
 
lcd_d7 = 18
lcd_red  = 4
+
lcd_red  = 4 # Led rouge
lcd_green = 17
+
lcd_green = 17 # Led Verte
lcd_blue  = 7  # Pin 7 is CE1
+
lcd_blue  = 7  # Led Bleue. Broche 7 est CE1
   −
# Example BeagleBone Black configuration:
+
# Example de configuration pour BeagleBone Black:
 
# lcd_rs = 'P8_8'
 
# lcd_rs = 'P8_8'
 
# lcd_en = 'P8_10'
 
# lcd_en = 'P8_10'
Ligne 226 : Ligne 221 :  
# lcd_d6 = 'P8_14'
 
# lcd_d6 = 'P8_14'
 
# lcd_d7 = 'P8_12'
 
# lcd_d7 = 'P8_12'
# lcd_red  = 'P8_7'
+
# lcd_red  = 'P8_7'  
 
# lcd_green = 'P8_9'
 
# lcd_green = 'P8_9'
 
# lcd_blue  = 'P8_11'
 
# lcd_blue  = 'P8_11'
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
The first important difference is the configuration of LCD pins. Notice there are now explicit pins defined for the red, green, and blue backlight LEDs.  
+
La première différence importante est la configuration des broches du LCD. Notez qu'il y a une définition explicite des broches pour le rouge, vert, bleu (respectivement ''red, green et blue'') du rétro-élcairage.  
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# Initialize the LCD using the pins
+
# Initialiser les broches de l'afficheur LCD  
 
lcd = LCD.Adafruit_RGBCharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7,
 
lcd = LCD.Adafruit_RGBCharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7,
 
                               lcd_columns, lcd_rows, lcd_red, lcd_green, lcd_blue)
 
                               lcd_columns, lcd_rows, lcd_red, lcd_green, lcd_blue)
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
The next line creates an instance of the '''Adafruit_RGBCharLCD''' class using the pin configuration defined earlier.
+
Cette ligne crée une instance de la classe '''Adafruit_RGBCharLCD''' (en utilisant la configuration des broches préalablement définie).
   −
The '''Adafruit_RGBCharLCD''' class inherits from the '''Adafruit_CharLCD''' class so it has all the same functionality as demonstrated in the '''char_lcd.py''' example. In addition to the basic character LCD functionality the RGB character LCD class adds some functions to set the RGB color of the backlight.  
+
La classe '''Adafruit_RGBCharLCD''' hérite de la classe '''Adafruit_CharLCD''', ce qui signfie que toutes les fonctionnalités préalablement démontrées dans l'exemple '''char_lcd.py''' sont également utilisable dans la classe Adafruit_RGBCharLCD. En plus des fonctionnalités de base de l'afficheur LCD la classe pour afficheur RGB ajoute des fonctions permettant de contrôler la couleur du rétro-éclairage.  
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# Show some basic colors.
+
# Affiche les couleurs fondamentales.
 
lcd.set_color(1.0, 0.0, 0.0)
 
lcd.set_color(1.0, 0.0, 0.0)
 
lcd.clear()
 
lcd.clear()
lcd.message('RED')
+
lcd.message('RED') # Rouge
 
time.sleep(3.0)
 
time.sleep(3.0)
    
lcd.set_color(0.0, 1.0, 0.0)
 
lcd.set_color(0.0, 1.0, 0.0)
 
lcd.clear()
 
lcd.clear()
lcd.message('GREEN')
+
lcd.message('GREEN') # Vert
 
time.sleep(3.0)
 
time.sleep(3.0)
    
lcd.set_color(0.0, 0.0, 1.0)
 
lcd.set_color(0.0, 0.0, 1.0)
 
lcd.clear()
 
lcd.clear()
lcd.message('BLUE')
+
lcd.message('BLUE') # Bleu
 
time.sleep(3.0)
 
time.sleep(3.0)
    
lcd.set_color(1.0, 1.0, 0.0)
 
lcd.set_color(1.0, 1.0, 0.0)
 
lcd.clear()
 
lcd.clear()
lcd.message('YELLOW')
+
lcd.message('YELLOW') # Jaune
 
time.sleep(3.0)
 
time.sleep(3.0)
    
lcd.set_color(0.0, 1.0, 1.0)
 
lcd.set_color(0.0, 1.0, 1.0)
 
lcd.clear()
 
lcd.clear()
lcd.message('CYAN')
+
lcd.message('CYAN') # Cyan
 
time.sleep(3.0)
 
time.sleep(3.0)
    
lcd.set_color(1.0, 0.0, 1.0)
 
lcd.set_color(1.0, 0.0, 1.0)
 
lcd.clear()
 
lcd.clear()
lcd.message('MAGENTA')
+
lcd.message('MAGENTA') # Magenta
 
time.sleep(3.0)
 
time.sleep(3.0)
    
lcd.set_color(1.0, 1.0, 1.0)
 
lcd.set_color(1.0, 1.0, 1.0)
 
lcd.clear()
 
lcd.clear()
lcd.message('WHITE')
+
lcd.message('WHITE') # Blanc
 
time.sleep(3.0)
 
time.sleep(3.0)
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
The code above demonstrates each basic color by calling the {{fname|set_color}} function and passing in which red, green, and blue LEDs to enable. For example the first call to {{fname|set_color(1.0, 0.0, 0.0)}} will turn on the '''red''' LED and turn off the green and blue LED so the backlight will have a '''red''' color.
+
Le code ci-dessus démontre l'affichage de des couleurs fondamentales en utilisant la fonction {{fname|set_color}} et en passant la valeur de la couleur rouge, vert, bleu en argument.
   −
Notice how later lines combine multiple LEDs to get different colors, like calling {{fname|set_color(1.0, 0.0, 1.0)}} to combine '''red''' and '''blue''' LEDs for a '''magenta/violet''' color.
+
Par exemple, le premier appel de {{fname|set_color(1.0, 0.0, 0.0)}} allume la LED '''rouge''' (''red'') et éteint les LED vertes (''green'') et bleue (''blue''). Le rétro-élcairage est donc '''rouge'''.
 +
 
 +
Notez que les lignes suivantes combine différentes couleur, comme l'appel {{fname|set_color(1.0, 0.0, 1.0)}} pour combiner du '''rouge''' (''red'') et du '''bleu''' (''blue'') pour obtenir la couleur '''magenta/violet'''.
 +
 
 +
Notez que la valeur des paramètres rouge, vert, bleu doit être comprise entre 0 et 1.
    
== Avec un MCP23017 + LCD ==
 
== Avec un MCP23017 + LCD ==
 
Si vous avez suivi le plan de montage avec le MCP23017 alors c'est cette partie du tutoriel qui vous intéresse.
 
Si vous avez suivi le plan de montage avec le MCP23017 alors c'est cette partie du tutoriel qui vous intéresse.
   −
{{traduction}}
+
La répertoire de la bibliothèque contient le fichier d'exemple '''char_lcd_mcp.py''' qui montre comment utiliser un afficheur LCD (version non-RGB) avec un GPIO expander MCP23017.  
The '''char_lcd_mcp.py''' file in the library's examples folder demonstrates the usage of a character LCD (non-RGB version) with an MCP23017 IO extender. Run the script by executing this command inside the examples directory:  
+
 
 +
Executez le script depuis le répertoire "examples" :  
    
  sudo python char_lcd_mcp.py
 
  sudo python char_lcd_mcp.py
   −
You should see a simple demo of the LCD displaying text, cursors, and scrolling just like the '''char_lcd.py''' demo described on the previous page.
+
Vous verrez une simple démo qui affiche du texte sur le LCD, manipule le curseur et fait défiler du texte comme pour la démo '''char_lcd.py''' (décrit dans la section précédente).
 +
 
 +
Vous pourrez voir comment l'exemple fonctionne avec un composant MCP si vous ouvrez le fichier '''char_lcd_mcp.py''' dans un éditeur de texte.  
 +
 
 +
Voyez l'aperçu du fichier ci-dessous:
   −
If you open '''char_lcd_mcp.py''' in a text editor you can see how to use the character LCD library with the MCP chip. Below is an overview of the file:
+
Le script commence par importer les modules nécessaires.
 +
 
 +
Notez qu'en plus d'importer le module Adafruit_GPIO.MCP230xx (importé sous le nom MCP). Cette classe MCP230xx sera utilisé pour dialoguer avec la puce MCP pour envoyer des informations sur l'interface du LCD.  
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 305 : Ligne 311 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
First the required modules are imported. Notice the addition of the Adafruit_GPIO.MCP230xx module (imported under the name MCP). This MCP230xx class will be used to talk to the MCP chip and interface with the LCD.
+
Ensuite, les broches de l'écran LCD sont définie dans le script.  
 +
 
 +
{{ambox-stop|text=Notez que ces numéros de broches sont celle des GPIOs de la puce MCP ET NON les numéros de broches du Raspberry Pi/BeagleBone Black!}}
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# Define MCP pins connected to the LCD.
+
# Definir les broches du MCP connectées sur le LCD.
 
lcd_rs        = 0
 
lcd_rs        = 0
 
lcd_en        = 1
 
lcd_en        = 1
Ligne 316 : Ligne 324 :  
lcd_d7        = 5
 
lcd_d7        = 5
 
lcd_backlight = 6
 
lcd_backlight = 6
# Optionally if the backlight is not controllable then set:
+
# Optionnel si le rétro-éclairage n'est pas contrôllable alors definisez:
 
# lcd_backlight = None
 
# lcd_backlight = None
   −
# Define LCD column and row size for 16x2 LCD.
+
# Définir le nombre de ligne (rows) et nombre de colonne (columns).
 +
# La taille définie ici est 16x2.
 
lcd_columns = 16
 
lcd_columns = 16
 
lcd_rows    = 2
 
lcd_rows    = 2
   −
# Alternatively specify a 20x4 LCD.
+
# Vous pouvez definir une taille alternative, par exemple 20x4.
 
# lcd_columns = 20
 
# lcd_columns = 20
 
# lcd_rows    = 4
 
# lcd_rows    = 4
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
Next the LCD pins are defined in the script. '''Note that these pin numbers are the MCP chip GPIO pin numbers, and NOT Raspberry Pi/BeagleBone Black pin numbers!'''
+
Ensuite, une instance de la classe MCP23017 est créée. Par défaut, cette class utilise l'adresse par défaut du MCP sur le bus I2C (0x20). La classe utilise également le bus par défaut de la plateforme de développement.
 +
 
 +
Si vous avez besoin d'utiliser une autre adresse ou autre bus I2C alors référez vous aux autres ligne en commentaire ci-dessous.
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# Initialize MCP23017 device using its default 0x20 I2C address.
+
# Initialiser le périphérique MCP23017 en utilisant l'adresse I2C par défaut (0x20).
 
gpio = MCP.MCP23017()
 
gpio = MCP.MCP23017()
   −
# Alternatively you can initialize the MCP device on another I2C address or bus.
+
# Initialisation alternative en utilisant une autre adresse I2C et autre bus.
 
# gpio = MCP.MCP23017(0x24, busnum=1)
 
# gpio = MCP.MCP23017(0x24, busnum=1)
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
Next an instance of the MCP23017 class is created. By default this class will use the I2C address 0x20 (default for MCP chips) and appropriate I2C bus for the running development board. However if you need to override the address or bus number you can see in the commented line how these are passed as parameters.
+
Vous pouvez également utiliser un MCP23008 mais dans ce cas, il faudra utiliser une instance de la classe '''MCP23008'''. Cette classe est exactement la même que celle du '''MCP23017''' mais elle supporte uniquement 8 broches GPIO.  
   −
Also note if you're using an MCP23008 chip you can instead create an instance of the '''MCP23008''' class. This class is exactly the same as the '''MCP23017''' class, but only supports 8 GPIO pins.  
+
Maintenant, nous allons créer une instance de la classe '''Adafruit_CharLCD''' . La grande différence par rapport à l'exemple précédent réside dans le passage de l'instance de la classe MCP23017 (sous le nom de variable 'gpio') en passant explicitement un paramètre nommé gpio.
 +
 
 +
<syntaxhighlight lang="python">
 +
# Initialize the LCD using the pins  
 +
lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7,
 +
                          lcd_columns, lcd_rows, lcd_backlight, gpio=gpio)
 +
</syntaxhighlight>
   −
Now the Adafruit_CharLCD class instance is created. The big difference with this line and previous examples is that the MCP23017 class (created with the name 'gpio') is passed in as the gpio parameter. By passing in an explicit gpio parameter, the char LCD class will use that GPIO class for talking to the LCD instead of the default development board GPIO pins.
+
En passant explicitement le paramètre ''gpio'', la classe '''Adafruit_CharLCD''' utilise cette classe GPIO, à la place du GPIO de la carte de développement, pour dialoguer avec l'écran LCD.
   −
The rest of the example code is exactly the same as the non-MCP character LCD example. You only need to change the setup and initialization of the character LCD class to use the MCP IO extender with an LCD!
+
Le reste de l'exemple est exactement identique à celui sans MCP. Vous avez uniquement besoin de changer la définition du LCD ainsi que modifier la création de la classe Adafruit_CharLCD (pour indiquer le nouveau gpio)!
   −
{{ambox|text=Note you can also use an RGB character LCD with an MCP IO extender, however the MCP IO extender does NOT support PWM control of the backlight!}}
+
{{ambox|text=vous pouvez également utiliser un un LCD RGB avec le MCP23017, il n'est cependant pas possible de contrôler la puissance du rétro-éclairage à l'aide de signal PWM!!}}
    
== L'exemple Horloge + IP ==
 
== L'exemple Horloge + IP ==
29 917

modifications

Menu de navigation