Modifications

Sauter à la navigation Sauter à la recherche
258 octets ajoutés ,  16 février 2015 à 18:50
Ligne 29 : Ligne 29 :     
== Editer main.py ==
 
== Editer main.py ==
Now we are going to write our Python program, so open the main.py file in a text editor. On Windows you can use notepad, or any other editor. On Mac and Linux, use your favourite text editor. With the file open you will see it contains 1 line:
+
Nous allons maintenant écrire notre programme Python. Ouvrez le fichier '''main.py''' avec un éditeur de texte. Sur Windows, vous pouvez utiliser notepad ou un autre éditeur. Sur Mac et Linux, utilisez votre éditeur favori. Une fois le fichier ouvert, vous devriez voir son contenu qui se résume en une seule ligne:
    
  <nowiki># main.py -- put your code here! (Placez votre code ici!)</nowiki>
 
  <nowiki># main.py -- put your code here! (Placez votre code ici!)</nowiki>
   −
This line starts with a # character, which means that it is a comment. Such lines will not do anything, and are there for you to write notes about your program.
+
Cette ligne commence par un caractère # indiquant qu'il s'agit d'une ligne de commentaire. Une telle ligne ne fait rien et son la uniquement pour insérer une note dans un programme.
   −
Let’s add 2 lines to this {{fname|main.py}} file, to make it look like this:
+
Ajoutons deux lignes dans ce fichier {{fname|main.py}} de façon a ce qu'il ressemble à ceci:
   −
  <nowiki># main.py -- put your code here!
+
  <nowiki># main.py -- put your code here!  
 
import pyb
 
import pyb
 
pyb.LED(4).on()</nowiki>
 
pyb.LED(4).on()</nowiki>
   −
The first line we wrote says that we want to use the {{fname|pyb}} module. This module contains all the functions and classes to control the features of the pyboard.
+
La première ligne indique à Micro Python que nous voulons utiliser le module {{fname|pyb}}. Ce module contient toutes le fonctions et les classe permettant de contrôler la carte pyboard.
   −
The second line that we wrote turns the blue LED on: it first gets the {{fname|LED}} class from the {{fname|pyb}} module, creates LED number 4 (the blue LED), and then turns it on.
+
Le seconde ligne indique que nous voulons allumer la LED bleue (en anglais, "''on''" signifie allumé). La ligne commence par obtenir la classe {{fname|LED}} depuis le module {{fname|pyb}}, crée la LED numéro 4 (correspond à la LED bleue) puis l'allume (avec l'appel à la fonction "''on()''").
    
== Réinitialiser la carte PyBoard ==
 
== Réinitialiser la carte PyBoard ==
29 917

modifications

Menu de navigation