issue95:arduino
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 | ||
issue95:arduino [2015/04/11 11:40] – d52fr | issue95:arduino [2015/04/14 15:37] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 7: | Ligne 7: | ||
First, the libraries. You can grab them (and some documentation) from: http:// | First, the libraries. You can grab them (and some documentation) from: http:// | ||
- | Il y a plusieurs mois, j'ai acheté une paire d' | + | Il y a plusieurs mois, j'ai acheté une paire d' |
C'est l' | C'est l' | ||
+ | |||
+ | Venant de vendeurs très bas de gamme tel Banggood (ou certains vendeurs sur eBay ou Amazon), la plupart des achats ne sont pas accompagnés d'une vraie notice. Ayant lu tous les commentaires sur Banggood et sur Google, j'ai enfin réussi à trouver la bonne bibliothèque, | ||
D' | D' | ||
Ligne 19: | Ligne 21: | ||
First, the important part that’s not mentioned in most documentation: | First, the important part that’s not mentioned in most documentation: | ||
+ | Installer les bibliothèques : allez sur l' | ||
+ | Certains des écrans que j'ai achetés dans le passé (tel que le Nokia 5110) arrivaient avec des connecteurs (les picots que vous branchez dans la plaque d' | ||
+ | |||
+ | Pour commencer, une chose importante qui n'est pas bien documentée : vous devez utiliser des résistances de 1k sur toutes les lignes de données. Autrement dit, toutes sauf les 5V, BL et GND. Vous devez aussi relier le picot BL à la ligne 5V. | ||
**Now, with it all wired up, we need some code. This code I’m going to show you is really for next month (where I’ll add an ultrasonic sensor), but it is still a good foundation of how to get the screen to show you something. | **Now, with it all wired up, we need some code. This code I’m going to show you is really for next month (where I’ll add an ultrasonic sensor), but it is still a good foundation of how to get the screen to show you something. | ||
Ligne 29: | Ligne 35: | ||
• The commented lines (beginning with //) are the pinouts for the screen. | • The commented lines (beginning with //) are the pinouts for the screen. | ||
• The extern lines are for the font(s) used on the screen. SmallFont() is about the best, but you can chop and change between it and, say, BigFont() in the code.** | • The extern lines are for the font(s) used on the screen. SmallFont() is about the best, but you can chop and change between it and, say, BigFont() in the code.** | ||
+ | |||
+ | Maintenant que tout est câblé, nous avons besoin de code. Le code que je veux vous montrer, ce sera plutôt pour le mois prochain (où j' | ||
+ | |||
+ | Le code est sur : http:// | ||
+ | |||
+ | Quelques précisions et remarques sur ce code : | ||
+ | • Vous pouvez ignorer le < | ||
+ | • Les lignes de commentaires (commençant par //) sont sur les branchements de l' | ||
+ | • Les lignes extern sont pour les polices utilisées avec l' | ||
**The setup() is exclusively for the screen. All commands with myGLCD are for the screen. Let’s look at a couple of them: | **The setup() is exclusively for the screen. All commands with myGLCD are for the screen. Let’s look at a couple of them: | ||
Ligne 49: | Ligne 64: | ||
A very important thing to note here is with the color values. Normally you would use RGB, but this screen uses BGR. Using 255,0,0 won’t get you red, it’ll get you blue.** | A very important thing to note here is with the color values. Normally you would use RGB, but this screen uses BGR. Using 255,0,0 won’t get you red, it’ll get you blue.** | ||
+ | |||
+ | La partie setup() est exclusivement pour l' | ||
+ | |||
+ | Nous commençons par initialiser l' | ||
+ | |||
+ | myGLCD.InitLCD() | ||
+ | |||
+ | et lui dire que nous voulons utiliser une petite police : | ||
+ | |||
+ | myGLCD.setFont(SmallFont). | ||
+ | |||
+ | Ensuite, nous effaçons l' | ||
+ | |||
+ | myGLCD.clrScr() | ||
+ | |||
+ | et choisissons une couleur à utiliser avec la commande suivante : | ||
+ | |||
+ | myGLCD.setColor(255, | ||
+ | |||
+ | Les valeurs de couleurs sont un point vraiment important à noter ici. Normalement, | ||
**Then we print ‘Distance in cm:’ one pixel down and in the center of the screen. | **Then we print ‘Distance in cm:’ one pixel down and in the center of the screen. | ||
Ligne 57: | Ligne 92: | ||
For now, feel free to read through the PDF’s in the ZIP you downloaded. It has some interesting commands in there that will let you draw shapes and even set the screen display to landscape/ | For now, feel free to read through the PDF’s in the ZIP you downloaded. It has some interesting commands in there that will let you draw shapes and even set the screen display to landscape/ | ||
+ | |||
+ | Ensuite, nous affichons « Distance in cm: » (Distance en cm : ), en descendant d'un pixel et centré sur l' | ||
+ | |||
+ | myGLCD.print(" | ||
+ | |||
+ | Le reste du code est principalement pour la détection sonar et l' | ||
+ | |||
+ | Pour le moment, n' |
issue95/arduino.1428745211.txt.gz · Dernière modification : 2015/04/11 11:40 de d52fr