Modifications

Sauter à la navigation Sauter à la recherche
Ligne 50 : Ligne 50 :     
{{traduction}}
 
{{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).
 +
 +
Vous pouvez utiliser n'importe quelle broche digitale GPIO dans la configuration.
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# Raspberry Pi pin configuration:
+
# Configuration des broches du Raspberry Pi :
lcd_rs        = 27  # Note this might need to be changed to 21 for older revision Pi's.
+
lcd_rs        = 27  # doit être changé à 21 pour les anciennes versions de Pi.
 
lcd_en        = 22
 
lcd_en        = 22
 
lcd_d4        = 25
 
lcd_d4        = 25
Ligne 61 : Ligne 65 :  
lcd_backlight = 4
 
lcd_backlight = 4
   −
# BeagleBone Black configuration:
+
# Configuration pour BeagleBone Black:
 
# lcd_rs        = 'P8_8'
 
# lcd_rs        = 'P8_8'
 
# lcd_en        = 'P8_10'
 
# lcd_en        = 'P8_10'
Ligne 71 : Ligne 75 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
The next part of the script configures which pins are connected to the LCD. You can see the Raspberry Pi configuration is uncommented by default, and below it the BeagleBone Black configuration is commented. You can use any digital GPIO pins in the configuration.  
+
Cette section du script configure la taille du LCD (en caractères). Par défaut, nous convenons qu'il y a 2 lignes (rows) de 16 caractères (16 columns [colonne]) chacune.
 +
 
 +
Il est cependant d'ajuster la configuration à 20x4 ou toute autre taille supportée par le contrôleur HD44780.  
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
# Define LCD column and row size for 16x2 LCD.
+
# -- Definition de la taille du LCD --
 +
# Ecran LCD de 16x2  
 +
# Definir le nbre de colonne du LCD (column) = nbre de carateres par lignes.
 
lcd_columns = 16
 
lcd_columns = 16
 +
# Definir le nombre de ligne du LCD (row)
 
lcd_rows    = 2
 
lcd_rows    = 2
   Ligne 83 : Ligne 92 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
This section of the script configures the size of the LCD. By default the code assumes a 16 column, 2 row LCD however you can adjust the configuration to a 20x4 or other size display supported by the HD44780.  
+
Next an instance of the '''Adafruit_CharLCD''' class is created based on the configuration specified earlier in the script.  
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 91 : Ligne 100 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Next an instance of the '''Adafruit_CharLCD''' class is created based on the configuration specified earlier in the script.  
+
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.
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 119 : Ligne 128 :  
</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.
+
 
    
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):  
 
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):  
29 917

modifications

Menu de navigation