Modifications

Sauter à la navigation Sauter à la recherche
1 220 octets ajoutés ,  3 avril 2016 à 18:19
Ligne 131 : Ligne 131 :  
Ce qui produit le résultat suivant:
 
Ce qui produit le résultat suivant:
   −
[[Fichier:MicroPython-ILI9341-Exemples-60.jpg|480px]]
+
[[Fichier:MicroPython-ILI9341-Exemples-60.jpg|320px]]
 +
 
 +
=== Exemple 2 ===
 +
Cet exemple effectue un tracé sur tout l'écran et permet d'évaluer la rapidité du tracé.
 +
 
 +
<nowiki>from lcd import *                                                         
 +
l = LCD( rate=21000000 )   
 +
# Tracé de haut en bas                                               
 +
for i in range( 0, 320, 8 ):
 +
    l.drawLine( 0,0, 240, i, CYAN )
 +
# tracé de gauche à droite
 +
for i in range( 0, 240, 8 ):
 +
    l.drawLine( 0,0, i, 320, MAGENTA )</nowiki>
 +
 
 +
Ce qui produit le résultat suivant:
 +
 
 +
[[Fichier:MicroPython-ILI9341-Exemples-61.jpg|320px]]
 +
 
 +
=== Exemple 3 ===
 +
Utilisation de la fonction {{fname|drawLine()}} pour un tracé graphique
 +
 
 +
<nowiki>from lcd import *
 +
from math import sin, trunc, radians
 +
 
 +
l = LCD( rate=21000000 )
 +
# Draw axis
 +
l.drawLine( 0,0, 240, 0, CYAN )
 +
l.drawLine( 120, 0, 120, 320, CYAN )
 +
 
 +
# Draw a sinus plot (in the height of the screen)
 +
previous=None
 +
for degree in range(0,320):
 +
    # screen x axis = SIN, screen y axis = degrees
 +
    point = ( trunc(120+sin(radians(degree))*120) , degree )
 +
    if previous != None:
 +
        l.drawLine( previous[0], previous[1], point[0], point[1], YELLOW )
 +
    previous = point</nowiki>
 +
 
 +
[[Fichier:MicroPython-ILI9341-Exemples-62.jpg|320px]]
    
== Rectangle ==
 
== Rectangle ==
29 917

modifications

Menu de navigation