Modifications

Sauter à la navigation Sauter à la recherche
5 072 octets supprimés ,  20 février 2016 à 15:44
Contenu remplacé par « {{MicroPython-Hack-Prepare-NAV}} {{MicroPython-Hack-REPL-core}} {{MicroPython-Hack-REPL-TRAILER}} »
Ligne 1 : Ligne 1 :  
{{MicroPython-Hack-Prepare-NAV}}
 
{{MicroPython-Hack-Prepare-NAV}}
   −
{{traduction}}
+
{{MicroPython-Hack-REPL-core}}
== REPL Kaseko?!? ==
  −
{{bloc-etroit|text=REPL signifie "Read Evaluate Print Loop" (boucle Lecture Evaluation Affichage). REPL est le nom donné au à la ligne commande interactive Micro Python accessible sur la carte. L'utilisation de REPL est de loin la façon la plus simple de tester votre code et exécuter des commandes. Vous pouvez utiliser REPL en plus d'écrire vis script dans main.py.}}
  −
 
  −
== Utiliser REPL ==
  −
Pour utiliser REPL, vous pouvez connecter le périphérique USB série sur la PyBoard.
  −
 
  −
La façon dont vous allez le faire dépend de votre système d'exploitation.
  −
 
  −
=== Sous Windows ===
  −
{{bloc-etroit|text=Vous devez intaller le pylote pyboard pour utiliser le périphérique série USB (''USB serial device''). Le pilote est disponible sur le lecteur USB de la PyBoard et s'appelle {{fname|pybcdc.inf}}.
  −
 
  −
Pour installerce pilote, vous aurez besoin de vous rendre dans le gestionnaire de périphérique (''Device Manager'') sur votre ordinateur, trouvez la PyBoard dans la liste des périphérique (il devrait y avoir une petite image "attention" juste à côté puisque le périphérique ne fonctionne pas encore). Faites un clique droit sur le périphérique PyBoard et sélectionnez "Propriété" dans le menu PUIS "Installer Pilote".<br />Vous devrez ensuite sélectionner l'option permettant de choisir le pilote manuellement (n'utilisez pas la mise-à-jour automatique de Windows!). Naviguez sur le lecteur USB de la carte PyBoard et sélectionnez le fichier {{fname|pybcdc.inf}} pour commencer l'installation du pilote.
  −
 
  −
Après l'installation, retournez dans le Gestionnaire de périphérique pour retrouver la PyBoard installée et vous devriez voir le port COM assigné (ex COM4). Pour plus d'information sur les instructions dans le document "[http://micropython.org/resources/Micro-Python-Windows-setup.pdf Guide for pyboard on Windows]" (Guide d'utilisation Micro Python sous Windows, ''PDF, Anglais''). Consultez ce guide si vous rencontrez des problèmes en installant le pilote.}}
  −
 
  −
{{underline|Maintenant, vous pouvez démarrer votre Terminal}}. Vous pouvez utiliser HyperTerminal s'il est déjà installé ou télécharger un logiciel libre tel que le célèbre PuTTY: [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html putty.exe].
  −
 
  −
Connectez vous sur le port COM trouvé ci-dessus à l'aide de votre programme Terminal. Avec PuTTY, cliquez sur "Session" puis sur la case radio "Serial" (série) pour pouvoir entrer le port COM (ex: COM4) dans la zone de saisie "Serial Line" (ligne série).
  −
 
  −
Pour finir, cliquez sur le bouton "Open" (ouvrir).
  −
 
  −
=== Sous MAC OS X ===
  −
Ouvrez un Terminal et exécutez:
  −
 
  −
<nowiki>screen /dev/tty.usbmodem*</nowiki>
  −
 
  −
Lorsque vous avez terminez et que vous voulez quitter le programme screen, tapez CTRL-A CTRL-\.
  −
 
  −
=== Linux ===
  −
Ouvrez un terminal et exécutez:
  −
 
  −
<nowiki>screen /dev/ttyACM0</nowiki>
  −
 
  −
You can also try ''picocom'' or ''minicom'' instead of screen. You may have to use {{fname|/dev/ttyACM1}} or a higher number for ttyACM. And, you may need to give yourself the correct permissions to access this devices (eg group {{fname|uucp}} or {{fname|dialout}} ou utiliser un bon vieux {{fname|sudo}}).
  −
 
  −
== Utiliser l'invite REPL ==
  −
Now let’s try running some Micro Python code directly on the pyboard.
  −
 
  −
With your serial program open (PuTTY, screen, picocom, etc) you may see a blank screen with a flashing cursor. Press Enter and you should be presented with a Micro Python prompt, i.e. {{fname|>>>}}. Let’s make sure it is working with the obligatory test:
  −
 
  −
<nowiki>>>> print("hello pyboard!")
  −
hello pyboard!</nowiki>
  −
 
  −
In the above, you should not type in the {{fname|>>>}} characters. They are there to indicate that you should type the text after it at the prompt. In the end, once you have entered the text {{fname|print("hello pyboard!")}} and pressed Enter, the output on your screen should look like it does above.
  −
 
  −
If you already know some python you can now try some basic commands here.
  −
 
  −
If any of this is not working you can try either a hard reset or a soft reset; see below.
  −
 
  −
Go ahead and try typing in some other commands. For example:
  −
 
  −
<nowiki>>>> pyb.LED(1).on()
  −
>>> pyb.LED(2).on()
  −
>>> 1 + 2
  −
3
  −
>>> 1 / 2
  −
0.5
  −
>>> 20 * 'py'
  −
'pypypypypypypypypypypypypypypypypypypypy'</nowiki>
  −
 
  −
== réinitialiser la carte ==
  −
If something goes wrong, you can reset the board in two ways. The first is to press CTRL-D at the Micro Python prompt, which performs a soft reset. You will see a message something like
  −
 
  −
<nowiki>>>>
  −
PYB: sync filesystems
  −
PYB: soft reboot
  −
Micro Python v1.0 on 2014-05-03; PYBv1.0 with STM32F405RG
  −
Type "help()" for more information.
  −
>>></nowiki>
  −
 
  −
If that isn’t working you can perform a hard reset (turn-it-off-and-on-again) by pressing the RST switch (the small black button closest to the micro-USB socket on the board). This will end your session, disconnecting whatever program (PuTTY, screen, etc) that you used to connect to the pyboard.
  −
 
  −
If you are going to do a hard-reset, it’s recommended to first close your serial program and eject/unmount the pyboard drive.
      
{{MicroPython-Hack-REPL-TRAILER}}
 
{{MicroPython-Hack-REPL-TRAILER}}
29 917

modifications

Menu de navigation