Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot-open:scriptingprogramming:remotedevelopment [2023/10/01 17:58] pczekalskien:iot-open:scriptingprogramming:remotedevelopment [2023/11/23 10:25] (current) pczekalski
Line 1: Line 1:
-===  ===  +====== Remote development in Python ====== 
-<box #5374d5></box> +{{:en:iot-open:czapka_b.png?50| General audience classification icon }}{{:en:iot-open:czapka_m.png?50| General audience classification icon }}{{:en:iot-open:czapka_e.png?50| General audience classification icon }}\\ 
-<box #5374d5></box> +As developers use PCs to author software, but it is executed in the microcontroller, using a terminal over a serial connection or secure shell (SSH) may not be convenient for larger projects. For this reason, many IDEs can perform remote development with code authored in the IDE on the PC but executed on the MCU. It requires a stable connection between the development host and the microcontroller and sometimes installation of the remote development host. One of the most flexible IDEs, able to act in virtually any scenario of remote development, is Visual Studio Code((https://code.visualstudio.com/docs/remote/remote-overview)). 
-=== Remote development in Python === +
-<box #5374d5></box> +
-<box #5374d5></box>+
  
-Programming Raspberry Pi with regular Python can be executed using development tools installed directly on the RPi, i.e. using Thonny((https://raspberrytips.com/thonny-ide-raspberry-pi/)). It is not the case of programming with Micropython that one needs to connect to it remotely. However, installing an external development environment on a PC or Mac computer is usually more convenient. Visual Studio Code comes with a ready solution for both scenarios.\\+Programming Raspberry Pi with regular Python can also be executed using development tools installed directly on the RPi, e.g. using Thonny((https://raspberrytips.com/thonny-ide-raspberry-pi/)). It is not the case of programming with Micropython that one needs to connect to it remotely. However, installing an external development environment on a PC or Mac computer is usually more convenient. Visual Studio Code comes with a ready solution for both scenarios.\\
  
 **Python**\\ **Python**\\
  In the case of the RPi programming, VS Code connects to the RPi via Secure Shell (SSH) and installs development tools remotely. The model is present in the figure {{ref>remotedevfigure1}}.  In the case of the RPi programming, VS Code connects to the RPi via Secure Shell (SSH) and installs development tools remotely. The model is present in the figure {{ref>remotedevfigure1}}.
 <figure remotedevfigure1> <figure remotedevfigure1>
-{{:en:iot-open:scriptingprogramming:python_remote_development_vs_code.png?600|}}+{{ :en:iot-open:scriptingprogramming:python_remote_development_vs_code.png?600 | Remote development for RPi with VS Code and Python}}
 <caption>Remote development for RPi with VS Code and Python</caption> <caption>Remote development for RPi with VS Code and Python</caption>
 </figure> </figure>
Line 18: Line 15:
 Initiate connection to the remote device: over SSH, the target RPi board runs Linux on ARM, here Rasbian, but is also works with other Linux distributions or even remote Docker containers exposing SSH (figures {{ref>remote1}} and {{ref>remote2}}): Initiate connection to the remote device: over SSH, the target RPi board runs Linux on ARM, here Rasbian, but is also works with other Linux distributions or even remote Docker containers exposing SSH (figures {{ref>remote1}} and {{ref>remote2}}):
 <figure remote1> <figure remote1>
-{{:en:iot-open:scriptingprogramming:screenshot_from_2023-09-29_18-33-15.png?600|}}+{{ :en:iot-open:scriptingprogramming:screenshot_from_2023-09-29_18-33-15.png?600 | Connecting to the remote development target from under VS Code}}
 <caption>Connecting to the remote development target from under VS Code</caption> <caption>Connecting to the remote development target from under VS Code</caption>
 </figure> </figure>
 <figure remote2> <figure remote2>
-{{:en:iot-open:scriptingprogramming:screenshot_from_2023-09-29_18-33-38.png?600|}}+{{ :en:iot-open:scriptingprogramming:screenshot_from_2023-09-29_18-33-38.png?600 | Connecting to the remote development target from under VS Code}}
 <caption>Connecting to the remote development target from under VS Code (cont.)</caption> <caption>Connecting to the remote development target from under VS Code (cont.)</caption>
 </figure> </figure>
-Remote development is straightforward, as in the case of the local one (figure {{ref>remote3}}:+Remote development is straightforward, as in the case of the local one (figure {{ref>remote3}}):
 <figure remote3> <figure remote3>
-{{:en:iot-open:scriptingprogramming:screenshot_from_2023-09-29_18-35-02.png?600|}}+{{ :en:iot-open:scriptingprogramming:screenshot_from_2023-09-29_18-35-02.png?600 | Python remote development for RPi in action, using VS Code}}
 <caption>Python remote development for RPi in action, using VS Code</caption> <caption>Python remote development for RPi in action, using VS Code</caption>
 </figure> </figure>
 +
 **Micropython**\\ **Micropython**\\
- +In the case of the Micropython, the connection is usually made via a serial port that is exposed either on the device's GPIOs (RX, TX) or as a Serial over USB. Micropython devices commonly expose a filesystem over the USB, alternatively to the Serial over USB. This is usually inducted with an onboard button press during the boot process. Boot system exposition enables an easy firmware (Micropython) update and source file management, such as uploading and downloading the libraries and application source code. A file named 'main.py' is executed automatically on boot if it only exists in the device's root folder and the device is not in the filesystem mode. Some devices (such as RP2040) also provide file management via Serial over USB and thus do not require enabling the filesystem mode manually but rather enable IDE to manage files along with development. For this reason, files can be stored locally and executed with REPL or stored remotely on the Micropython device. A concept of the code development for Micropython is graphically present in the figure {{ref>remotedevfigure2}}.\\
-In the case of the Micropython, the connection is usually made via a serial port that is exposed either on the device's GPIOs (RX, TX) or as a Serial over USB. Micropython devices are used to expose a filesystem over the USB, alternatively to the Serial over USB. This is usually inducted with an onboard button press during the boot process. Boot system exposition enables an easy firmware (Micropython) update and source file management, such as uploading and downloading the libraries and application source code. A file named 'main.py' is executed automatically on boot if it only exists in the device's root folder and the device is not in the filesystem mode. Some devices (such as RP2040) also provide file management via Serial over USB and thus do not require enabling the filesystem mode manually but rather enable IDE to manage files along with development. For this reason, files can be stored locally and executed with REPL or stored remotely on the Micropython device. A concept of the code development for Micropython is graphically present in the figure {{ref>remotedevfigure2}}.\\+
  
 <figure remotedevfigure2> <figure remotedevfigure2>
-{{:en:iot-open:scriptingprogramming:micropython_remote_development_vs_code_2.png?600|}}+{{ :en:iot-open:scriptingprogramming:micropython_remote_development_vs_code_2.png?600 | Remote development for Micropython-enabled devices with VS Code and Python}}
 <caption>Remote development for Micropython-enabled devices with VS Code and Python (Micropython)</caption> <caption>Remote development for Micropython-enabled devices with VS Code and Python (Micropython)</caption>
 </figure> </figure>
  
-  +Remote development requires a VS Code plugin to communicate with the Micropython device. One of them is MicroPico, which is dedicated to Raspberry RP2040 (Pico and Pico W), and it can be installed and updated with VS Code extension manager (figure {{ref>micropicovscode}}).
-Remote development requires a VS Code plugin able to communicate with the Micropython device. One of them is MicroPico, which is dedicated to Raspberry RP2040 (Pico and Pico W), and it can be installed and updated with VS Code extension manager (figure {{ref>micropicovscode}}).+
 <figure micropicovscode> <figure micropicovscode>
-{{:en:iot-open:scriptingprogramming:screenshot_from_2023-10-01_19-06-45.png?600|}}+{{ :en:iot-open:scriptingprogramming:screenshot_from_2023-10-01_19-06-45.png?600 | MicroPico extension for Visual Studio Code}}
 <caption>MicroPico extension for Visual Studio Code</caption> <caption>MicroPico extension for Visual Studio Code</caption>
 </figure> </figure>
- +Code then can be stored locally or remotely and easily executed via the right-click command (figure {{ref>remotemicropython1}}): 
- +<figure remotemicropython1> 
 +{{ :en:iot-open:scriptingprogramming:screenshot_from_2023-10-01_20-04-57.png?600 | Executing Python code on Micropython device}} 
 +<caption>Executing Python code on Micropython device (RP2040)</caption> 
 +</figure>
  
en/iot-open/scriptingprogramming/remotedevelopment.1696183134.txt.gz · Last modified: 2023/10/01 17:58 by pczekalski
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0