Modifications

Sauter à la navigation Sauter à la recherche
2 767 octets supprimés ,  20 février 2016 à 15:36
Contenu remplacé par « {{MicroPython-Hack-Prepare-NAV}} {{MicroPython-Hack-first-script-core}} {{MicroPython-Hack-first-script-TRAILER}} »
Ligne 1 : Ligne 1 :  
{{MicroPython-Hack-Prepare-NAV}}
 
{{MicroPython-Hack-Prepare-NAV}}
   −
== Introduction ==
+
{{MicroPython-Hack-first-script-core}}
{{bloc-etroit|text=Let’s jump right in and get a Python script running on the pyboard. After all, that’s what it’s all about!}}
  −
 
  −
== Connecter le PyBoard ==
  −
{{bloc-etroit|text=Connect your pyboard to your PC (Windows, Mac or Linux) with a micro USB cable. There is only one way that the cable will connect, so you can’t get it wrong.}}
  −
 
  −
{{MPImage|MicroPython-Hack-first-script-00.jpg}}
  −
 
  −
{{bloc-etroit|text=When the pyboard is connected to your PC it will power on and enter the start up process (the boot process). The green LED should light up for half a second or less, and when it turns off it means the boot process has completed.}}
  −
 
  −
== Ouvrir le lecteur USB du PyBoard ==
  −
 
  −
Your PC should now recognise the pyboard. It depends on the type of PC you have as to what happens next:
  −
 
  −
* '''Windows:''' Your pyboard will appear as a removable USB flash drive. Windows may automatically pop-up a window, or you may need to go there using Explorer.<br />Windows will also see that the pyboard has a serial device, and it will try to automatically configure this device. If it does, cancel the process. We will get the serial device working in the next tutorial.
  −
* '''Mac:''' Your pyboard will appear on the desktop as a removable disc. It will probably be called “NONAME”. Click on it to open the pyboard folder.
  −
* '''Linux:''' Your pyboard will appear as a removable medium. On Ubuntu it will mount automatically and pop-up a window with the pyboard folder. On other Linux distributions, the pyboard may be mounted automatically, or you may need to do it manually. At a terminal command line, type {{fname|lsblk}} to see a list of connected drives, and then {{fname|mount /dev/sdb1}} (replace {{fname|sdb1}} with the appropriate device). You may need to be root to do this.
  −
 
  −
Okay, so you should now have the pyboard connected as a USB flash drive, and a window (or command line) should be showing the files on the pyboard drive.
  −
 
  −
The drive you are looking at is known as {{fname|/flash}} by the pyboard, and should contain the following 4 files:
  −
* [http://micropython.org/resources/fresh-pyboard/boot.py boot.py] - this script is executed when the pyboard boots up. It sets<br />up various configuration options for the pyboard.
  −
* [http://micropython.org/resources/fresh-pyboard/main.py main.py] - this is the main script that will contain your Python program.<br />It is executed after {{fname|boot.py}}.
  −
* [http://micropython.org/resources/fresh-pyboard/README.txt README.txt] - this contains some very basic information about getting started with the pyboard.
  −
* [http://micropython.org/resources/fresh-pyboard/pybcdc.inf pybcdc.inf] - this is a Windows driver file to configure the serial USB device. More about this in the next tutorial.
  −
 
  −
== Editer main.py ==
  −
{{traduction}}
      
{{MicroPython-Hack-first-script-TRAILER}}
 
{{MicroPython-Hack-first-script-TRAILER}}
29 917

modifications

Menu de navigation