Modifications

Sauter à la navigation Sauter à la recherche
aucun résumé de modification
Ligne 2 : Ligne 2 :     
{{traduction}}
 
{{traduction}}
 +
For most MicroPython boards you can access the MicroPython REPL (read-evaluate-print loop) over their USB serial connections.  Be sure to first follow any instructions and install drivers specific to your board to ensure you can access the USB serial connection:
 +
 +
* [https://wiki.mchobby.be/index.php?title=MicroPython-Hack-REPL#Sous_Windows pyboard needs drivers to be installed on Windows]
 +
* [https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx Feather HUZZAH ESP8266 needs drivers to be installed on Mac OSX or Windows]
 +
* [https://wiki.mchobby.be/index.php?title=FEATHER-CHARGER-MICROPYTHON-MICROBIT BBC micro:bit needs drivers to be installed on Windows] (''en bas de page'').
 +
 +
Note the WiPy board REPL is only accessible over its wireless interface with telnet. Follow the WiPy instructions for connecting to the telnet REPL instead of the steps below for accessing with a serial terminal.
 +
 +
Determine the name of the serial port for your board.  It's easiest to look at the serial ports with the board disconnected
 +
* on Windows check '''Device Manager''' under the '''Ports (COM/LPT)''' node,
 +
* or on Mac OSX/Linux run the ls /dev/tty.* command in a terminal,
 +
 +
Then connect the board and look at the serial ports again to find the newly added port.
 +
 +
'''On Windows''' you'll want to use a tool like [http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY] to connect to the serial port.  Download and run PuTTY, then configure it to use a serial connection to the board's COM port at 115200 baud similar to as shown below:
 +
 +
{{ADFImage|FEATHER-CHARGER-MICROPYTHON-SERIAL-REPl-10.png}}
 +
 +
{{ADFImage|FEATHER-CHARGER-MICROPYTHON-SERIAL-REPl-11.png}}
 +
 +
'''On Linux or Mac OSX''' the screen command can be used to connect to the serial port.  Run the following command to connect at 115200 baud:
 +
 +
<nowiki>screen /dev/tty.board_name 115200</nowiki>
 +
 +
Where '''/dev/tty.board_name''' is the name of the board's serial port.
 +
 +
When you're done using screen most versions of it allow you to exit by pressing '''Ctrl-a''' then '''k''' then '''y''' or presing '''Ctrl-a''' then typing :quit and pressing enter.
 +
 +
After you're connected to the serial REPL try pressing enter to confirm you see the '''>>>''' prompt.  You can also type '''help()''' and press enter on most boards to see basic usage information.
 +
 +
If you can't get a '''>>>''' prompt to appear try pressing '''Ctrl-c''' a couple times to interrupt any running program on the board.
 +
 +
That's all there is to connecting to the board's serial REPL, you're ready to start typing in and running MicroPython code!
 +
    
{{FEATHER-CHARGER-MICROPYTHON-TRAILER}}
 
{{FEATHER-CHARGER-MICROPYTHON-TRAILER}}
29 918

modifications

Menu de navigation