Modifications

Sauter à la navigation Sauter à la recherche
452 octets ajoutés ,  9 février 2018 à 13:17
aucun résumé de modification
Ligne 1 : Ligne 1 :  
{{RASP-PiOLED-NAV}}
 
{{RASP-PiOLED-NAV}}
  −
{{traduction}}
      
== Introduction ==
 
== Introduction ==
Ligne 228 : Ligne 226 :  
     Disk = subprocess.check_output(cmd, shell = True )
 
     Disk = subprocess.check_output(cmd, shell = True )
   −
     # Ecrire deux lignes de texte
+
     # Ecrire quatre lignes de texte
 
     draw.text((x, top),      "IP: " + str(IP),  font=font, fill=255)
 
     draw.text((x, top),      "IP: " + str(IP),  font=font, fill=255)
 
     draw.text((x, top+8),    str(CPU), font=font, fill=255)
 
     draw.text((x, top+8),    str(CPU), font=font, fill=255)
Ligne 234 : Ligne 232 :  
     draw.text((x, top+25),    str(Disk),  font=font, fill=255)
 
     draw.text((x, top+25),    str(Disk),  font=font, fill=255)
   −
     # Display image.
+
     # Afficher l'image sur l'écran
 
     disp.image(image)
 
     disp.image(image)
 
     disp.display()
 
     disp.display()
     time.sleep(.1)
+
    # pause de 100 millisecondes
 +
     time.sleep(.1)  
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
Using the subprocess class, python can utilize linux commands to access the Pi's system information. This loop updates the screen at 10 times a second.<br><br>That's all there is to the '''stats.py''' code!
+
En utilisant la classe subprocess, python peut utiliser des commandes Linux pour accéder aux informations systèmes du Pi. La boucle {{fname|while}} effectue un rafraîchissement de l'écran 10 fois par seconde.  
 +
 
 +
Voilà, c'est tout en ce qui concerne le code de '''stats.py''' !
 +
 
 +
== Plus d'exemples ==
 +
Vous pouvez consulter les autres exemples du sous-répertoire {{fname|examples}}.
   −
== More Demos & Examples ==
+
Assurez-vous d'éditer chacun des exemples (avec '''nano animate.py''' par exemple) et trouvez la ligne mentionnant:
You can check out our other examples in the example, just make sure to edit each one with '''nano animate.py''' for example, and find the line that says:
      
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 250 : Ligne 253 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
and change it to:
+
et la changer en :
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
 
# Raspberry Pi pin configuration:
 
# Raspberry Pi pin configuration:
RST = None # PiOLED does not require reset pin
+
RST = None # PiOLED n'a pas besoin de la broche Reset
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
and make sure that the configuration section where you choose which type of display, looks like this
+
puis assurez vous que la configuration section utilise la déclaration correspond à votre afficheur PiOled... comme ceci:
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
Ligne 273 : Ligne 276 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
That is, we'll be using I2C 128x32 display!
+
Voila, le script d'exemple utilise maintenant un afficheur I2C 128x32 pixels (sans broche Reset)!
   −
== Speeding Up the Display ==
+
== Améliorer la vitesse de l'afficheur ==
For the best performance, especially if you are doing fast animations, you'll want to tweak the I2C core to run at 1MHz. By default it may be 100KHz or 400KHz
+
Pour de meilleures performances, plus spécialement si vous avez besoin d'animation rapide, vous pouvez optimiser le fonctionnement du bus I2C pour qu'il fonctionne 1MHz. En effet, le bus est configuré à la fréquence 100KHz ou 400KHz
   −
To do this edit the config with '''sudo nano /boot/config.txt'''
+
Pour modifier la vitesse du bus, éditez le fichier de configuration avec '''sudo nano /boot/config.txt'''
   −
and add to the end of the file
+
et ajoutez la ligne suivante à la fin du fichier
   −
'''dtparam=i2c_baudrate=1000000'''
+
<syntaxhighlight lang="python">
 +
dtparam=i2c_baudrate=1000000
 +
</syntaxhighlight>
    
{{ADFImage|RASP-PiOLED-Utiliser-06.png|640px}}
 
{{ADFImage|RASP-PiOLED-Utiliser-06.png|640px}}
   −
reboot to 'set' the change.
+
Redémarrer le Pi pour appliquer les modifications.
 
      
{{RASP-PiOLED-TRAILER}}
 
{{RASP-PiOLED-TRAILER}}
29 922

modifications

Menu de navigation