Ligne 1 : |
Ligne 1 : |
| {{LCD-USB-TTL-NAV}} | | {{LCD-USB-TTL-NAV}} |
| | | |
− | {{bloc-etroit|text=Next we will demonstrate how to send text and commands using an Arduino microcontroller. You can of course use any microcontroller that has a serial output you can configure for 9600 baud. This demo will show how to set the display size, RGB backlight and create a custom character. For more commands, see below for the full list of supported commands | + | {{bloc-etroit|text=Ensuite, nous allon montrer comment envoyer du texte et des commandes en utilisant un microcontrôleur Arduino. Vous pouvez, bien entendu, utiliser n'importe quel microcontrôleur qui dispose d'un port série configuré à 9600 bauds. Cette démo indique comment initialiser la taille de l'écran, le rétro-éclairage RGB et de créer des caractères personnalisé. Pour plus de commandes, voyez la liste de référence des commandes |
| | | |
− | Grab an Arduino and connect the JST cable to the backpack as follows: Red wire goes to +5V, Black wire goes to Ground, White data wire goes to digital #2. You can change the digital pin later, but stick with #2 for this example and adjust later as desired.}}
| + | Attrapez votre Arduino, connectez le câble JST sur le backpack comme suit: Le fil rouge sur +5V, le fil noir sur la masse et le fil blanc sur la broche digital #2 de votre Arduino. Comme nous utilisons la bibliothèque SoftwareSerial, vous pourrez utiliser d'autres broches digitales si vous le voulez. Pour le moment, nous allons utiliser la broche #2.}} |
| | | |
| <nowiki>#include <SoftwareSerial.h> | | <nowiki>#include <SoftwareSerial.h> |
| | | |
| | | |
− | // Create a software serial port! | + | // Créer un port série logiciel! |
| SoftwareSerial lcd = SoftwareSerial(0,2); | | SoftwareSerial lcd = SoftwareSerial(0,2); |
| | | |
Ligne 14 : |
Ligne 14 : |
| lcd.begin(9600); | | lcd.begin(9600); |
| | | |
− | // set the size of the display if it isn't 16x2 (you only have to do this once) | + | // Initialiser la taille de l'afficheur si ce n'est pas un 16x2 (ne doit être fait qu'une seule fois) |
| lcd.write(0xFE); | | lcd.write(0xFE); |
| lcd.write(0xD1); | | lcd.write(0xD1); |
− | lcd.write(16); // 16 columns | + | lcd.write(16); // 16 colonnes |
− | lcd.write(2); // 2 rows | + | lcd.write(2); // 2 lignes |
| delay(10); | | delay(10); |
− | // we suggest putting delays after each command to make sure the data | + | // Nous recommandons d'utiliser un délais après chaque commande pour être certain que |
− | // is sent and the LCD is updated. | + | // les commandes soient exécutée par le LCD et que ce dernier soit mis-à-jour. |
| | | |
− | // set the contrast, 200 is a good place to start, adjust as desired | + | // Fixer le contrast, 200 est un bon point de départ. Ajustez en fonction de vos besoins |
| lcd.write(0xFE); | | lcd.write(0xFE); |
| lcd.write(0x50); | | lcd.write(0x50); |
Ligne 29 : |
Ligne 29 : |
| delay(10); | | delay(10); |
| | | |
− | // set the brightness - we'll max it (255 is max brightness) | + | // Fixer la luminosité - utilisons la valeur maximale (255 est la luminosité maximale) |
| lcd.write(0xFE); | | lcd.write(0xFE); |
| lcd.write(0x99); | | lcd.write(0x99); |
Ligne 35 : |
Ligne 35 : |
| delay(10); | | delay(10); |
| | | |
− | // turn off cursors | + | // désactiver le curseur |
| lcd.write(0xFE); | | lcd.write(0xFE); |
| lcd.write(0x4B); | | lcd.write(0x4B); |
Ligne 41 : |
Ligne 41 : |
| lcd.write(0x54); | | lcd.write(0x54); |
| | | |
− | // create a custom character | + | // Créer un caractère personnalisé |
| lcd.write(0xFE); | | lcd.write(0xFE); |
| lcd.write(0x4E); | | lcd.write(0x4E); |
− | lcd.write((uint8_t)0); // location #0 | + | lcd.write((uint8_t)0); // Position #0 |
− | lcd.write((uint8_t)0x00); // 8 bytes of character data | + | lcd.write((uint8_t)0x00); // 8 bytes/octets de données pour le caractère |
| lcd.write(0x0A); | | lcd.write(0x0A); |
| lcd.write(0x15); | | lcd.write(0x15); |