Modifications

Sauter à la navigation Sauter à la recherche
Ligne 351 : Ligne 351 :  
{{traduction}}
 
{{traduction}}
   −
Maintenant nous avons créé une instance de la classe Adafruit_CharLCD . 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.
+
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.
    
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!
 
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!
 +
 +
<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>
 +
 +
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=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=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!}}
29 917

modifications

Menu de navigation