issue111:python
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| issue111:python [2016/08/20 09:15] – d52fr | issue111:python [2016/08/24 11:18] (Version actuelle) – andre_domenech | ||
|---|---|---|---|
| Ligne 8: | Ligne 8: | ||
| • Many breadboard jumpers, Male to Male and 8 Male to Female** | • Many breadboard jumpers, Male to Male and 8 Male to Female** | ||
| - | Le mois dernier, nous avons travaillé avec le capteur de température DS18B20. Ce mois-ci, nous commencerons par interfacer un afficheur LCD 16x2 pour montrer nos températures. Ne défaites pas votre montage, mais assurez-vous que vous avez assez de place pour monter votre afficheur sur la plaque d' | + | Le mois dernier, nous avons travaillé avec le capteur de température DS18B20. Ce mois-ci, nous commencerons par interfacer un afficheur LCD 16x2 pour montrer nos températures. Ne défaites pas votre montage, mais assurez-vous que vous avez assez de place pour monter votre afficheur sur la plaque d' |
| + | |||
| + | Bien sûr, l' | ||
| + | |||
| + | Nous ferons 8 connexions au RPi, en plus des trois que nous utilisions le mois dernier pour le capteur de température. Ce mois-ci, nous aurons besoin des composants supplémentaires suivants : | ||
| + | • un potentiomètre de 10k ; | ||
| + | • un afficheur LCD 16x2 ; | ||
| + | • de nombreux cavaliers pour la plaque d' | ||
| **By the time you are done, the wiring diagram (and the resulting board) will look like a bit of a rat’s nest, but go slowly – make sure you have the wiring correct. | **By the time you are done, the wiring diagram (and the resulting board) will look like a bit of a rat’s nest, but go slowly – make sure you have the wiring correct. | ||
| Ligne 17: | Ligne 24: | ||
| On the display, connect pin 1 to ground and pin 2 to the +5 volt buss. That makes three connections out of the twelve we need. Pin 6 of the display goes to pin 22 of the RPi. This is the Enable pin. Pin 5 on the display goes to ground, and pin 4 to pin 27 on the RPi. We are up to 6 connections so far. That makes us halfway there. Because we have to use pin 4 for our sensor, we can’t control the backlight.** | On the display, connect pin 1 to ground and pin 2 to the +5 volt buss. That makes three connections out of the twelve we need. Pin 6 of the display goes to pin 22 of the RPi. This is the Enable pin. Pin 5 on the display goes to ground, and pin 4 to pin 27 on the RPi. We are up to 6 connections so far. That makes us halfway there. Because we have to use pin 4 for our sensor, we can’t control the backlight.** | ||
| + | |||
| + | Une fois terminé, le schéma de câblage (et en vrai sur la plaque) ressemblera un peu à un plat de nouilles, mais allez-y lentement, assurez-vous de faire le câblage correctement. | ||
| + | |||
| + | Comme vous pouvez le voir sur le schéma ci-dessus, c'est plutôt horrible ; aussi, je vais vous détailler tout le câblage dans un texte. | ||
| + | |||
| + | D' | ||
| + | |||
| + | Sur l' | ||
| **Now we will work backwards from pin 16. Pin 16 goes to ground, and pin 15 to +5v. Pin 15 is actually the backlight voltage on mine. If you find the display too bright, you could put the wiper of another potentiometer connected between +5v and ground and control the display backlight. | **Now we will work backwards from pin 16. Pin 16 goes to ground, and pin 15 to +5v. Pin 15 is actually the backlight voltage on mine. If you find the display too bright, you could put the wiper of another potentiometer connected between +5v and ground and control the display backlight. | ||
| Now for the data lines. There are actually 8 data lines, but thankfully, we will be using only 4. Pins 11 to 14 are D4, D5, D6 and D7 (counting from 0). Here is the connection list. | Now for the data lines. There are actually 8 data lines, but thankfully, we will be using only 4. Pins 11 to 14 are D4, D5, D6 and D7 (counting from 0). Here is the connection list. | ||
| + | |||
| Now everything is hooked up, so we will continue with some sample code to test the display. But we need to get the Adafruit python library for LCDs. In a terminal window, type the following... | Now everything is hooked up, so we will continue with some sample code to test the display. But we need to get the Adafruit python library for LCDs. In a terminal window, type the following... | ||
| Ligne 30: | Ligne 46: | ||
| cd examples** | cd examples** | ||
| + | |||
| + | Maintenant, nous allons travailler en descendant depuis le picot 16. Le picot 16 va à la masse, et le picot 15 au +5 V. Sur le mien, le picot 15 est en fait le voltage du rétro-éclairage. Si vous trouvez l' | ||
| + | |||
| + | Maintenant, les lignes de données. Il y a réellement 8 lignes de données, mais, heureusement, | ||
| + | |||
| + | Maintenant tout est connecté et nous continuerons avec un échantillon de code pour tester l' | ||
| + | |||
| + | git clone https:// | ||
| + | |||
| + | cd Adafruit_Python_CharLCD | ||
| + | |||
| + | sudo python setup.py install | ||
| + | |||
| + | cd examples | ||
| **Now load char_lcd.py into your favorite editor. Or, you could type it in from the previous page. | **Now load char_lcd.py into your favorite editor. Or, you could type it in from the previous page. | ||
| Ligne 47: | Ligne 77: | ||
| That’s about it for this month. Next month we will look at changing out our regular 16x2 display for a 16x2 I2C display (which uses only 2 lines for data and all control, and 2 lines for power.) We will also discuss the different ways of using serial communication for interfacing displays and other devices. Until then, have fun!** | That’s about it for this month. Next month we will look at changing out our regular 16x2 display for a 16x2 I2C display (which uses only 2 lines for data and all control, and 2 lines for power.) We will also discuss the different ways of using serial communication for interfacing displays and other devices. Until then, have fun!** | ||
| + | |||
| + | Maintenant, chargez char_lcd.py dans votre éditeur favori. Ou vous pouvez le copier à la main de la page précédente. | ||
| + | |||
| + | Ignorez les messages de rétro-éclairage ; mais vous devrez voir : | ||
| + | |||
| + | Hello World! (Bonjour le monde) | ||
| + | Show Cursor_ (curseur visible) | ||
| + | Blink Cursor_ (curseur clignotant) | ||
| + | Scroll (right and left) (déplacement, | ||
| + | Flash backlight in 5 seconds... (rétro-éclairage flashant dans 5 secondes) | ||
| + | Goodbye! (Au revoir !) | ||
| + | |||
| + | Si tout a bien fonctionné, | ||
| + | |||
| + | Voici le programme du mois dernier, modifié, qui inclut des bribes de code venant de cet exemple (en haut à droite) d' | ||
| + | |||
| + | C'est tout pour cette fois. Le mois prochain, nous examinerons le remplacement de notre afficheur 16x2 classique par un afficheur IC2 16x2 (qui n' | ||
issue111/python.1471677311.txt.gz · Dernière modification : 2016/08/20 09:15 de d52fr
