Raspberry Pi Remote Development Based On vscode Tutorial

From Waveshare Wiki
Jump to: navigation, search

Introduction

If you want to edit code on your Raspberry Pi, it often involves starting the graphical interface on the Raspberry Pi through an additional display or remote desktop connection. However, additional monitors come with costs, and remote desktop connections are often too sluggish to facilitate efficient work. Is there a more affordable and convenient development method?
The answer is yes – you can leverage the capabilities of VSCode's SSH remote development extension for a quick and budget-friendly solution.

Tutorial

First, make sure your Raspberry Pi has an SSH server installed.
If not, please install the ssh service by executing the following statement from the command line in the Raspberry Pi.

sudo apt install openssh-server

First, open vscode on your computer and click on the expand button in the left column.
Vscode remote ssh1.png

Search for remote and select remote-ssh, remote explorer to download and install.
Scode remote ssh2.png

A new remote option will be added to the sidebar after the installation is complete, choose to click on it.
Vscode remote ssh5.png

Next, with SSH in Remote Explorer, click on the + sign on the right.
Vscode remote ssh3.png

Next, enter your Raspberry Pi's IP address in the upper center field and press enter. (Make sure your computer and Raspberry Pi are connected to the same network and wifi).
Vscode remote ssh6.png

Select the first one and press enter again.
Vscode remote ssh7.png

Then an inconspicuous pop-up box will appear in the bottom right corner of vscode, click connect on the right.
Vscode remote ssh8.png

Then type your Raspberry Pi username in the center of the vscode and press enter. Wait for a while and if nothing happens, the connection is successful!
Vscode remote ssh9.png

On the left sidebar click first on Manager and then on Add Working Directory.
Vscode remote ssh10.png

Enter the path to the folder in your Raspberry Pi where you need to write the program and press enter.
Vscode remote ssh12.png

Finally, select the trusted folder in the pop-up window to start remote development.
Vscode remote ssh11.png