(Note that this mode change is not permanent - if you reset the device and open it with another program, REPL is back in regular mode. For the user it is still presented as regular REPL. Mode under the hood to run the scripts, query global variables, etc. plain MicroPython serial REPLĪfter connecting to your device, Thonny switches it to raw REPL mode and uses this You can upload / download data and library files and directories via respective commands in the file browser (View => Files) via files' context menu (opened by right-clicking on a file). This can be done easily by selecting "Run => Send EOF / Soft reboot (Ctrl+D)". as "main.py"), you can check how your device would perform without Thonny. When you have saved your script onto the device (eg. It doesn't matter whether your script is stored on the local disk or on the device - in both ways Thonny simply submits the program text to device's REPL. The easiest way to test your script is to execute it like you would with the CPython back-end - "Run → Run current script (F5)". It is too easy to lose your work if you rely only on the device's flash memory. This means that if you are using a different version of firmware then theĪutocompleter may offer some names that are not present on your device and miss some that are.Īlthough Thonny allows you to work without saving anything locally, for serious work we recommend keeping master copies of your scripts in your main computer (preferably under version control) and copy them to the device as required (File => Save copy as). This is based on the API-s scraped from specific devices with specific MicroPython / CircuitPython versions (different for each backend type). You can also open files by double-clicking them in Thonny's file browser (View => Files).ĭuring editing your scripts, Thonny offers autocomplete (performed by the jedi library). Note that Thonny always synchronizes file writes - this reduces the risk of corrupt files when you accidentally reset your device without proper eject right after saving a file onto its USB drive. Same goes to save commands ("Save", "Save as", "Save copy as"). When you have a MicroPython back-end selected, "File => Open" allows you to open a file either from local disk, device's USB drive, or "directly" form your device's file system. On your device yet, then see below for the section about firmware installation.) Editing scripts (If you don't have suitable MicroPython (or CircuitPython) firmware installed One board connected, then you could leave this setting for automaticĪfter you press "OK", Thonny's shell should present either the prompt of yourĭevice's REPL or the output of the script which is currently running on your device. Now you can specify the port your device is connected to. NB! Since version 3.3 you can also use the back-end switcher in the lower-right corner of Thonny's main window. Specific back-end, then try "MicroPython (generic)". The type of your device from the drop-down list. In Thonny, open the back-end manager (Run → Select interpreter) and choose If required, install the necessary drivers for serial communication. Configurationīefore continuing, make sure that you have your device attached to a USB port. See the bottom of the page for historical notes. This page describes MicroPython support since Thonny 3.2.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |